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

1 vue (au cours des 30 derniers jours)
Adam Dyson
Adam Dyson le 4 Oct 2016
Commenté : Adam Dyson le 5 Oct 2016
plot y = 10 cos(2t)on the interval −pi ≤ t ≤ pi with 100 points in the plot
  1 commentaire
Wayne King
Wayne King le 4 Oct 2016
Adam, can you please show what you have attempted.

Connectez-vous pour commenter.

Réponses (1)

Daniel Pereira
Daniel Pereira le 4 Oct 2016
Modifié(e) : Daniel Pereira le 4 Oct 2016
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;

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by