I need help graphing a function.
1 次查看(过去 30 天)
显示 更早的评论
The code creates a graph but I'm pretty sure it's wrong because It's supposed to look closer to a cos(x) graph
t=linspace(0,100,101);
y=(3.*((2.71828).^(-t./2))).*(cos(4.*pi.*t));
plot(t,y);
grid
0 个评论
采纳的回答
Star Strider
2023-9-27
It probably should be a decaying sinusoid.
The problem is that it decays too fast. Decreasing the magnitude of ‘t’ helps to visualise it correctly. (I suspect the problem is the ‘exp(-t./2)’ term. The constant should be smaller than 0.5 to get the result you lilely want with the original ‘t’.)
t=linspace(0,100,101)/10;
y = 3.*exp(-t./2).*cos(4.*pi.*t);
plot(t,y);
grid
.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!