quick easy question
1 回表示 (過去 30 日間)
古いコメントを表示
im trying to write an rlc script, and it doesn't like my Vc line. what is my error? i've already established alpha omega and t.
if (Alpha^2 < Omega0^2);
Omega_d = sqrt(Omega0^2 - Alpha^2);
% Frequency of sin(wt) term
fprintf('The Circuit is UNDERDAMPED! [alpha<omega]\r\n');
B1 = -Vb;
B2 = ((Alpha*B1)/Omega_d);
Vc = 10 + (B1*cos*(Omega_d*t) + B2*sin*(Omega_d*t))*(exp(-Alpha*t));
plot(t, Vc, 'blue'); %plot the underdamped case in blue
end
0 件のコメント
回答 (2 件)
Dr. Seis
2012 年 5 月 4 日
It looks like "t" is an array of numbers, therefore you need to incorporate a "." before you multiply "(B1*cos*(Omega_d*t) + B2*sin*(Omega_d*t))" and "(exp(-Alpha*t))" to produce element-by-element multiplication. I.e.:
Vc = 10 + (B1*cos(Omega_d*t) + B2*sin(Omega_d*t)).*(exp(-Alpha*t));
Also, you have an "*" between you trig functions. Remove the "*" between the "cos" and "(Omega_d*t)" and similarly with the "sin" and "(Omega_d*t)"
0 件のコメント
katerina jablonski
2012 年 5 月 4 日
1 件のコメント
Dr. Seis
2012 年 5 月 4 日
Oh heck... sorry I glazed over that one. Remove the "*" between the "cos" and "(Omega_d*t)" and similarly with the "sin" and "(Omega_d*t)"
参考
カテゴリ
Help Center および File Exchange で Circuits and Systems についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!