グラフのx軸の座標をある点のx座標を0から始まるよう変更したい
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Takumi Enomoto
le 16 Jan 2023
Réponse apportée : Hernia Baby
le 16 Jan 2023
画像のような図を複数のcsvデータ毎に作成するコードを作成しています。
データ全体から範囲を切り取っているため、x軸のあたいがばらばらになってしまいます。
今あるグラフのx座標のスタートが0になるようにするにはどうしたらよいでしょうか。
0 commentaires
Réponse acceptée
Atsushi Ueno
le 16 Jan 2023
>今あるグラフのx座標のスタートが0になるようにするにはどうしたらよいでしょうか。
t 全体から t(1)即ち先頭の値を減算すれば良いです
t = (4.5:0.01:7.49)';
x = rand(size(t)) * 4 + 3;
x(1:120) = rand(120,1) * 0.2 - 0.1;
plot(t,x,'LineWidth',2); % 4.5[s]から7.49[s]までを切り取ったので、その通りに表示される
t = t - t(1); % t 全体から t(1)即ち先頭の値を減算する
plot(t,x,'LineWidth',2); % 0[s]からのデータとして表示される
0 commentaires
Plus de réponses (2)
交感神経優位なあかべぇ
le 16 Jan 2023
AxesオブジェクトのXLimプロパティを変更することで、X軸の開始と終了を指定できます。
p = plot([-1,1], [0,1]);
p.Parent.XLim(1) = 0;% 0から開始の指定
0 commentaires
Voir également
Catégories
En savoir plus sur 2 次元および 3 次元プロット dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!