Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Can't seem to get the functions to graph properlly

1 回表示 (過去 30 日間)
Bethany Ramsbottom
Bethany Ramsbottom 2020 年 10 月 28 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
alpha = [-0.5 -1.2 -2.1]
beta = [8 5.3 2.5]
t = 0:0.5:5
e = 2.71828
y1 = (e.^(-((-.5).*t))).*sin(8.*t);
y2 = (e.^(-((alpha(2))).*t)).*sin(beta(2).*t);
y3 = (e.^(-((alpha(3))).*t)).*sin(beta(3).*t);
plot(t,y1)
hold on
plot(t,y2,'m','LineWidth',1)
hold on
plot(t,y3,'b','LineWidth',1)
xlabel('time [sec]')
ylabel('amplitude')
title('\sigma as a function of time')
legend('Case 1','Case 2', 'Case 3')
grid on
When I plot the equations it seems to ignore the sin function and gives me a single spike not sure where I went wrong.

回答 (1 件)

Kelly Kearney
Kelly Kearney 2020 年 10 月 28 日
You've chosen a pretty coarse resolution for t. If you change it to something like
t = linspace(0,5,100);
do you get what you expect?

この質問は閉じられています。

タグ

製品


リリース

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by