フィルターのクリア

How can I plot a graph within a certain range?

3 ビュー (過去 30 日間)
Víctor García
Víctor García 2019 年 3 月 5 日
コメント済み: Walter Roberson 2019 年 3 月 6 日
I am new to Matlab and I've been plotting for a while, but now I would like to plot 100 specific samples obtained from a temperature sensor within 100 seconds.
y=[20.50,20.50,20.50,20.50,20.50,20.50,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.620.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.70,20.70,20.60,20.60,20.70,20.70,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20 60,20.60,20.60,20.60,20.60,20.60,20.60,20.50,20.50,20.50,20.50,20.40,20.40,19.80,19.80,19.00,19.00,18.40,18.40,18.20,18.20,17.80,17.80,17.30,17.30,16.90,16.9 16.60,16.60,16.30,16.30,16.20,16.20,16.20,16.20,16.00,16.00,15.60,15.60,15.40,15.40,15.10,15.10,14.60,14.60,14.40,14.40]
The Y-Axis would be "Temp
erature" and the X-axis would be "Time" which has a duration of 100 seconds. My question is how can I establish an X-axis of 100 values without having to write something like the Y-Axis 100 times:
x=[1,2,3,4,5,6,7,8,9...]

採用された回答

Yasasvi Harish Kumar
Yasasvi Harish Kumar 2019 年 3 月 5 日
Hi,
This should fix your problem,
y=[20.50,20.50,20.50,20.50,20.50,20.50,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.620.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.70,20.70,20.60,20.60,20.70,20.70,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20.60,20 60,20.60,20.60,20.60,20.60,20.60,20.60,20.50,20.50,20.50,20.50,20.40,20.40,19.80,19.80,19.00,19.00,18.40,18.40,18.20,18.20,17.80,17.80,17.30,17.30,16.90,16.9 16.60,16.60,16.30,16.30,16.20,16.20,16.20,16.20,16.00,16.00,15.60,15.60,15.40,15.40,15.10,15.10,14.60,14.60,14.40,14.40];
x = 1:1:100;
plot(x,y)
Regards
  2 件のコメント
Víctor García
Víctor García 2019 年 3 月 6 日
Thank you! it really helped me a lot :)
Walter Roberson
Walter Roberson 2019 年 3 月 6 日
Also, if you just plot(y) then MATLAB presumes that x is 1 : length(y) for vector y, and 1:size(y,1) for two or more dimensional y.

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by