I need to limit a data set to 1000 points between -pi and pi

5 ビュー (過去 30 日間)
Adam Dyson
Adam Dyson 2016 年 10 月 4 日
コメント済み: Adam Dyson 2016 年 10 月 5 日
plot y = 10 cos(2t)on the interval −pi ≤ t ≤ pi with 100 points in the plot
  1 件のコメント
Wayne King
Wayne King 2016 年 10 月 4 日
Adam, can you please show what you have attempted.

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

回答 (1 件)

Daniel Pereira
Daniel Pereira 2016 年 10 月 4 日
編集済み: Daniel Pereira 2016 年 10 月 4 日
I think this is what you want:
t = linspace(-pi,pi,100);
y = 10*cos(2*t);
plot(t,y);
% Pretty plot
set(gca,'xtick',linspace(-pi,pi,9),'xticklabel',{'-pi','-3·pi/4','-pi/2','-pi/4','0','pi/4','pi/2','3·pi/4','pi'});
xlim(t([1 end]));
grid on; box on;

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by