
how to plot m(t)=cos(2*pi*9*t) 0<t<3 and m(t)=0 otherwise
조회 수: 7 (최근 30일)
이전 댓글 표시
how to plot m(t)=cos(2*pi*9*t) 0<t<3 and m(t)=0 otherwise
댓글 수: 0
채택된 답변
Star Strider
2016년 3월 15일
This works:
m = @(t) cos(2*pi*9*t) .* ((t > 0 ) & (t < 3));
t = linspace(-1, 4, 500);
Out = m(t);
figure(1)
plot(t, Out)
grid

댓글 수: 2
Star Strider
2016년 3월 15일
Change the ‘t’ assignment to:
t = linspace(-1, 4, 5000);
to improve the resolution by a factor of 10. Increase the third argument (here 5000) to get the resolution you want, if this is not enough.
추가 답변 (3개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!