Plotting part of an array

101 ビュー (過去 30 日間)
Jacob Huhtala
Jacob Huhtala 2020 年 9 月 29 日
コメント済み: Jacob Huhtala 2020 年 9 月 29 日
This is probably a super easy question to answer and im just blanking out. But im trying to plot this array, which is time in seconds, but i only want to plot it up to 0.2 seconds. Its being plotted agaisnt volts to make a sin curve. I've included the lines of code, and both arrays. Thank you for your help ahead of time.
plot(TimeT3_2048<0.2,VoltsT3_2048)
title('Task 3 2048 Volts v. Time')
xlabel('Time [Sec]')
ylabel('Volts [V]')

回答 (1 件)

Sindar
Sindar 2020 年 9 月 29 日
simplest:
xlim([0 0.2])
  2 件のコメント
Sindar
Sindar 2020 年 9 月 29 日
in the style you had, you'd do this:
plot(TimeT3_2048( TimeT3_2048<0.2 ),VoltsT3_2048( TimeT3_2048<0.2 ))
it doesn't make sense for this case, but there are others where it woud be useful:
  • plot a range based on a third variable
  • plot based on a more complicated condition
  • when you have a ridiculous quantity of data and don't want it all to be saved in the figure file
Jacob Huhtala
Jacob Huhtala 2020 年 9 月 29 日
Thank you!

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

カテゴリ

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

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by