Weird line on sine graph
조회 수: 4 (최근 30일)
이전 댓글 표시
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
채택된 답변
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)');
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!