I need to limit a data set to 1000 points between -pi and pi
2 次查看(过去 30 天)
显示 更早的评论
plot y = 10 cos(2t)on the interval −pi ≤ t ≤ pi with 100 points in the plot
回答(1 个)
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 Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!