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
beta, zeta1, zeta2 are constants.
r is defined as logspace(-2, 2, 4001)
0 件のコメント
採用された回答
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
%% 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
2024 年 1 月 18 日
@Yuvraaj Pasumarthy, From the plot, I guess that this related to a Base Excitation model.
その他の回答 (1 件)
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)
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!