
how to plot m(t)=cos(2*pi*9*t) 0<t<3 and m(t)=0 otherwise
4 次查看(过去 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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!