Weird line on sine graph

조회 수: 4 (최근 30일)
Rhiannon Elliott
Rhiannon Elliott 2021년 2월 16일
댓글: Rhiannon Elliott 2021년 2월 16일
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)')

채택된 답변

David Hill
David Hill 2021년 2월 16일
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)');
  댓글 수: 1
Rhiannon Elliott
Rhiannon Elliott 2021년 2월 16일
Thank you so much for your help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by