How to remove units from a plot?

51 ビュー (過去 30 日間)
André Galera
André Galera 2020 年 10 月 15 日
コメント済み: Walter Roberson 2023 年 1 月 31 日
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!
  5 件のコメント
Rasmus
Rasmus 2023 年 1 月 31 日
I would still like to know how i get rid of the units...? Its very annoying that they cannot be removed.
Walter Roberson
Walter Roberson 2023 年 1 月 31 日
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
fig = figure();
lsim(G,sq_wave,t);
Warning: Simulation will start at a nonzero initial time.
L = findall(fig, 'String', 'Time (seconds)');
L.String = 'Time';
This was a weird one. It turns out that the labels that are visible are in a separate axes that is marked Visible off and HandleVisibility off. I have no idea why they would bother to do that.

サインインしてコメントする。

採用された回答

Shae Morgan
Shae Morgan 2020 年 10 月 16 日
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 件のコメント
André Galera
André Galera 2020 年 10 月 16 日
It worked. Thanks so much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by