MATLAB Answers

How to remove units from a plot?

8 views (last 30 days)
Hello! How can I remove the unit "seconds" for the x label? I need to use the unit in another language. I searched everywhere and I coul not find a helpfull answer. Thank you!

  3 Comments

Kevin Chng
Kevin Chng on 16 Oct 2020
possible share your code, so we could help you better
Walter Roberson
Walter Roberson on 16 Oct 2020
At the moment I suspect it would be a matter of changing the axes xlabel()
André Galera
André Galera on 16 Oct 2020
I tried to use xlabel('text'), but the output label is: text (seconds). I wish I could delete the "seconds".
I need to compute the system response for a square wave input.
num = [37.5 13875 1125000]; den = [2.45 38.125 6205 1125000];
G = tf(num,den);
t = 1:0.01:5;
sq_wave = 0.01*square(2*pi*0.3.*t,50);
%% plot the response
lsim(G,sq_wave,t)
The plot goes automatically with the x label "Time (seconds)".
Matlab sets automatically the unit seconds.

Sign in to comment.

Accepted Answer

Shae Morgan
Shae Morgan on 16 Oct 2020
You can try to save and re-plot the output of the graph, then use xlabel to solve your problem.
[z,x,y]=lsim(G,sq_wave,t)
plot(x,y)
xlabel('time')
Hope that's helpful!

  1 Comment

André Galera
André Galera on 16 Oct 2020
It worked. Thanks so much!

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!