フィルターのクリア

I am writing relatively long expression and it's showing me "Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mis-matc

1 回表示 (過去 30 日間)
wn = 196570;
r = 6351.43;
chi = 0:1:2;
phim = 1;
ke = 1.134;
w = 1/(wn.^2*sqrt(1+(r.*chi.)^2))*sqrt((1-(1+2*phim.*r.)*chi.)^2+((1+ke.^2)*r.*chi.+2*phim.*chi.-r.*chi.^3)^2);
plot(chi,w)

採用された回答

Walter Roberson
Walter Roberson 2022 年 10 月 14 日
not (r.*chi.)^2 but (r.*chi).^2
  3 件のコメント
Walter Roberson
Walter Roberson 2022 年 10 月 14 日
w = 1 ./ (wn.^2 .* sqrt(1+
(r.*chi).^2)) .* sqrt((1-(1+2*phim.*r).*chi).^2 + ((1+ke.^2) .* r .* chi + 2*phim.*chi - r.*chi.^3).^2);
The period is not a suffix. A.*B is not parsed as (A.)*B with trailing period meaning something like "treat the result of the previous expression as an element-by-element matrix for whatever operation is next". Instead, the character pair .* is an operator that is different than the * operator, and ./ is an operator that is different than / operator, and .^ is a different operator than ^ (and .\ is an obscure operator different than \ )

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by