フィルターのクリア

error: elobrate on it

3 ビュー (過去 30 日間)
Meyyappan
Meyyappan 2012 年 5 月 18 日
% Optimization of Tuned mass damper parameters
wn = input('natural frequency of main system, wn:');
z = input('damping factor,z:');
ms = input('mass of main system, ms:');
md = input('mass of damper system, md:');
% Tuned damper parameters
kd = input('Stiffness of damper, kd:');
zd = input('damping factor, zd:');
wd = kd/md;
w = 0:1:1000;
% Non-dimensional parameters
r = w/wn;
rd = wd/wn;
m = ms/md; % Fixed for a setup
for s=1: length(r)
G(s,:)= sqrt((rd.^2-r.^2).^2+4*zd.^2*rd.^2*r.^2)./{((1-r.^2)*(rd.^2-r.^2)-m*rd.^2*r.^2-4*z*zd*rd*r.^2).^2+4*(zd*rd*r*(1-r.^2-m*r.^2)+z*r*(rd.^2-r.^2)).^2}.^(1/2);
Re(s,:) = {(rd.^2 -r.^2)*(1-r.^2)*(rd.^2-r.^2)-m*rd.^2*r.^2+ 4*(zd.^2*rd.^2*r.^2*(1-r.^2-m*r.^2))}./{((1-r.^2)*(rd.^2-r.^2)-m*rd.^2*r.^2-4*z*zd*rd*r.^2).^2+4*(zd*rd*r*(1-r.^2-m*r.^2)+z*r*(rd.^2-r.^2)).^2}.^(1/2);
end
figure (1)
plot(r,G)
xlabel ('\omega/\omega_n')
ylabel ('|x (i\omega)|/F')
grid
figure (2)
plot(r, Re)
xlabel ('\omega/\omega_n')
ylabel ('Non-dimensional real part (Re)')
grid
error:
Error using *
Inner matrix dimensions must agree.
Error in two_dof (line 16)G(s,:) = sqrt((rd.^2-r.^2).^2+4*zd.^2*rd.^2*r.^2)./{((1-r.^2)*(rd.^2-r.^2)-m*rd.^2*r.^2-4*z*zd*rd*r.^2).^2+4*(zd*rd*r*(1-r.^2-m*r.^2)+z*r*(rd.^2-r.^2)).^2}.^(1/2);

採用された回答

Walter Roberson
Walter Roberson 2012 年 5 月 18 日
The "*" operator is matrix multiplication.
Your variable "r" is a row vector, so (1-r.^2) is a row vector and (rd.^2-r.^2) is a row vector of the same length. You cannot matrix-multiply a 1 x N array by a 1 x N array: matrix multiplication requires that the second dimension of the first array be the same as the first dimension of the second array.
If your code gets past that, then your code will still fail, as you cannot apply arithmetic operations such as division to cell arrays. The {} brackets are only for building cell arrays. The [] brackets are only for building vectors and matrices. The () brackets are the only arithmetic grouping operators in MATLAB.
  1 件のコメント
Meyyappan
Meyyappan 2012 年 5 月 21 日
Walter thankz for ur kind info. I have ended up in correcting the mistakes.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNonlinear ARX Models についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by