What does "invalid use of operator" mean here? I add parenthesis, that becomes error, i remove it and then the operator becomes the error...

2 ビュー (過去 30 日間)
sqrt((1-(beta^2+4*zeta1*zeta2*beta)*(r.^2)).^2 + 4*(r.^2).*(zeta1+zeta2*beta-zeta1*beta^2*(r.^2)).^2)/sqrt({1-[(1+mu)*beta^2+1+4*zeta1*zeta2*beta]*(r.^2) + (beta^2)*(r.^4)}.^2 + 16*(zeta1 +zeta2*beta)*r. - [zeta1*(1+mu)*beta^2 + zeta2*beta]*(r.^3)).^2
Invalid use of operator.
beta, zeta1, zeta2 are constants.
r is defined as logspace(-2, 2, 4001)

採用された回答

Sam Chak
Sam Chak 2024 年 1 月 18 日
I didn't check the correctness of your equation. However, I have fixed some parentheses and added a dot division.
%% Display the equation
syms beta zeta1 zeta2 r mu
X = sqrt((1 - (beta^2 + 4*zeta1*zeta2*beta)*(r^2))^2 + 4*(r^2)*(zeta1 + zeta2*beta - zeta1*beta^2*(r^2))^2)/sqrt((1-((1+mu)*beta^2+1+4*zeta1*zeta2*beta)*(r^2) + (beta^2)*(r^4))^2 + 16*(zeta1 +zeta2*beta)*r - (zeta1*(1+mu)*beta^2 + zeta2*beta)*(r^3))^2
G = 
%% Plot
r = logspace(-2, 2, 4001);
beta = 2;
zeta1 = sqrt(3)/2;
zeta2 = 1/sqrt(2);
mu = 0.1;
X = sqrt( (1 - (beta^2 + 4*zeta1*zeta2*beta)*(r.^2)).^2 + 4*(r.^2).*(zeta1 + zeta2*beta - zeta1*(beta^2)*r.^2).^2)./sqrt((1 - ((1 + mu)*beta^2 + 1 + 4*zeta1*zeta2*beta)*(r.^2) + (beta^2)*(r.^4)).^2 + 16*(zeta1 + zeta2*beta)*r - (zeta1*(1 + mu)*beta^2 + zeta2*beta)*(r.^3)).^2;
semilogx(r, X), grid on
xlabel('r'), ylabel('X')
  2 件のコメント
Sam Chak
Sam Chak 2024 年 1 月 18 日
@Yuvraaj Pasumarthy, From the plot, I guess that this related to a Base Excitation model.
Yuvraaj Pasumarthy
Yuvraaj Pasumarthy 2024 年 1 月 20 日
@Sam Chak Not exactly, I was trying to get a relation between mu and r without really changing up the reference equation which gives a relation b/w transmissibilty and r. i wanted to avoid a lengthy simplification. While the equation provided by you and the others help, I still need to make changes to the rest of the code to make that viable.
Any suggestions how I can go about it? I thank you for your answer for my old question from a few months ago, I was trying to play with that to get a solution for this.

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

その他の回答 (1 件)

Selena Mastrodonato
Selena Mastrodonato 2024 年 1 月 18 日
Hi Yuvraaj,
the invalid operator is here, the dot after r: sqrt((1-(beta^2+4*zeta1*zeta2*beta)*(r.^2)).^2 + 4*(r.^2).*
(zeta1+zeta2*beta-zeta1*beta^2*(r.^2)).^2)/sqrt({1-[(1+mu)*beta^2+1+4*zeta1*zeta2*beta]*(r.^2) + (beta^2)*(r.^4)}.^2 + 16*(zeta1 +zeta2*beta)*r. - [zeta1*(1+mu)*beta^2 + zeta2*beta]*(r.^3)).^2
Furthermore, some parenthesis seem wrong. This should work
sqrt((1-(beta^2+4*zeta1*zeta2*beta)*(r.^2)).^2 + 4*(r.^2).*(zeta1+zeta2*beta-zeta1*beta^2*(r.^2)).^2)/sqrt({1-[(1+m)*beta^2+1+4*zeta1*zeta2*beta]*(r.^2) + (beta^2)*(r.^4)}.^2 + 16*(zeta1 +zeta2*beta)*r - [zeta1*(1+m)*beta^2 + zeta2*beta]*(r.^3).^2)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by