Weird line on sine graph
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Rhiannon Elliott
le 16 Fév 2021
Commenté : Rhiannon Elliott
le 16 Fév 2021
Hi! I was wondering if anyone had any ideas as to why there is a horizontal line plotted on the figure below? I'm struggling to figure out why! I checked the variables stored in the x vector, and nothing was out of the ordinary.
I'm hoping I have just missed something obvious, perhaps with my time column vector?
%Defining the time column vector, as required
t = [0:0.001:2,1]';
x = [cos(2*pi.*t) sin(2*pi.*t)];
plot(t,x)
xlabel('time')
ylabel('x')
title('Exercise 2 figure')
legend('cos(2*pi*t)','sin(2*pi*t)')

0 commentaires
Réponse acceptée
David Hill
le 16 Fév 2021
t = 0:0.001:2;
x = [cos(2*pi.*t); sin(2*pi.*t)];
plot(t,x(1,:),t,x(2,:));
xlabel('time');
ylabel('x');
title('Exercise 2 figure');
legend('cos(2*pi*t)','sin(2*pi*t)');
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Graphics Performance dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!