MATLAB changing axis labes on step()/margin() functions help required please

Click For Summary
SUMMARY

The discussion focuses on modifying axis labels in MATLAB plots generated by the step() and margin() functions within a GUI created using GUIDE. The user, Chris, encounters an issue where the default axis labels display time in seconds instead of the desired minutes. A solution involves setting the XTick and XTickLabel properties to customize the tick marks and their corresponding labels. Additionally, a MATLAB function available on the MathWorks File Exchange can assist in this customization process.

PREREQUISITES
  • Familiarity with MATLAB GUI development using GUIDE
  • Understanding of transfer functions and their representations
  • Knowledge of MATLAB plotting functions, specifically step() and margin()
  • Basic programming skills in MATLAB for manipulating plot properties
NEXT STEPS
  • Explore the use of XTick and XTickLabel properties in MATLAB for custom labeling
  • Investigate the MATLAB function available on the MathWorks File Exchange for further customization
  • Learn about formatting time in MATLAB using sprintf for HH:MM:SS representation
  • Review MATLAB documentation on plotting functions and their properties
USEFUL FOR

This discussion is beneficial for MATLAB developers, GUI designers, and engineers working with control systems who need to customize plot labels for better clarity and presentation in their applications.

HeZ
Messages
10
Reaction score
1
Hi all,

I am having a little trouble with a MATLAB GUI that i am writing, with GUIDE. Its purpose is basically to display the bode diagram and step response of a transfer function, and allow the user to change controller parameters/time delays and such to see the affect. I won't post my code here, because it works perfectly. (unless anyone wants it)

The one thing i am having trouble with is changing the labels of the plots drawn by step/margin functions. My transfer functions are actually in minutes whereas the plot automatically labels the axis as seconds.

Margin looks like: 'Frequency (rad/sec)'
Step looks like : 'Time (sec)'

I have tried using xlabel('newLabel');
However what that just replaces the 'Frequency' Label with 'newLabel', whilst the (rad/sec) component remains.
This is the same deal for the step plot.

I have googled this extensively and cannot seem to find the answer :(

Thanks in advance,
Chris
 
  • Like
Likes   Reactions: MMG19
Physics news on Phys.org
you can set these two properties: XTick XTickLabel

XTICK sets where the tick marks are, the label set WHAT they are (can be text)

Now, you can write a loop with sprintf to make a series of numbers into the text you want if you want to do HH:MM:SS time.

There's also a MATLAB function on the file exchange that might help:

http://www.mathworks.com/matlabcentral/fileexchange/15986
 

Similar threads

Replies
2
Views
3K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 1 ·
Replies
1
Views
3K