[問題] 一個關於震盪的問題~matlab跑不出來已回收

看板MATLAB作者 (Queen~)時間16年前 (2008/10/09 00:47), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
%第二次作業第一小題 function homework21 = homework21(Wn,u0,v0) Tn = 2*pi/Wn ; for i = 1:5000 t(i) = 0.005*(i-1); h1 = 2; % Overdamped system a11 = -h1*Wn + Wn*sqrt(h1^2-1); a21 = -h1*Wn - Wn*sqrt(h1^2-1); A1 = (v0-a21*u0)./(a11-a21); B1 = (a11*u0-v0)./(a11-a21); u1(i) = A1*exp(a11*t(i))+B1*exp(a21*t(i)); h2 = 1; % Critically System a12 = -h2*Wn ; A2 = v0 - a12*u0 ; B2 = u0 ; u2(i) = (A2*t(i)+B2)*exp(a12*t(i)); h3 = 0.1; % Underdamped System WD = Wn*sqrt(1-h3^2); A3 = u0; B3 = (v0 +h3*Wn*u0)/WD; u3(i) = exp(-h3*Wn.*t(i)).*(A3*cos(WD*t(i))+B3*sin(WD*t(i))); r = sqrt(u0^2+((v0+h3*Wn*u0)/WD)^2); u4(i) = r*exp(-h3*Wn*t(i)); u5(i) = -r*exp(-h3*Wn*t(i)); if u0 == 0 U1(i) = u1(i); U2(i) = u2(i); U3(i) = u3(i); U4(i) = u4(i); U5(i) = u5(i); else U1(i) = u1(i)./u0; U2(i) = u2(i)./u0; U3(i) = u3(i)./u0; U4(i) = u4(i)./u0; U5(i) = u5(i)./u0; end T(i) = t(i)./Tn; end plot (T,U1,'b-',T,U2,'r-',T,U3,'k-',T,U4,'m:',T,U5,'m:'); legend('Overdamped, \zeta = 2','Critically damped, \zeta = 1','Underdamped, \zeta = 0.1','Response Envelope Curve'); xlabel('t/Tn'); ylabel('u(t)/u(0)'); title('Vo = 0'); axis ([0 3 -inf inf]); 不知道是哪裡少了 一直出現錯誤 各位大大可以幫我找出哪裡出錯了嗎???謝謝 -- ╭ 這篇文章讓你覺得?═════════════════════════╮ ║ ║ ║ ──+ ︵ ︵ . .! ˇ ˇ ╲ ╱ ˇˇ || ◣ ◢║ ║ ̄﹀ ̄  ̄▽ ̄ ▄ ▇△▇ ≧﹏≦b  ̄︶ ̄y  ̄– ̄ 皿 ║ ║ 新奇 溫馨 誇張 難過 實用 高興 無聊 生氣 ║ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.135.151

10/09 17:09, , 1F
把題目簡化過再來問比較好~~那麼長一篇
10/09 17:09, 1F
文章代碼(AID): #18xEGaPx (MATLAB)
文章代碼(AID): #18xEGaPx (MATLAB)