![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/173692/image.png)
how to plot m(t)=cos(2*pi*9*t) 0<t<3 and m(t)=0 otherwise
3 次查看(过去 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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/173692/image.png)
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geographic Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!