quick easy question

조회 수: 1 (최근 30일)
katerina jablonski
katerina jablonski 2012년 5월 4일
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

답변 (2개)

Dr. Seis
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)"

katerina jablonski
katerina jablonski 2012년 5월 4일
here is the error response. i tried the "." and it still doesn't like it! frustrating. i don't really know how to use matlab, and our teacher is not helpful.
??? Error using ==> cos Not enough input arguments.
Error in ==> ANOTHERTRY at 65 Vc = 10 + (B1*cos*(Omega_d*t) + B2*sin*(Omega_d*t)).*(exp(-Alpha*t));
  댓글 수: 1
Dr. Seis
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 CenterFile Exchange에서 Circuits and Systems에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by