which part of my logic is wrong?

1 回表示 (過去 30 日間)
2NOR_Kh
2NOR_Kh 2022 年 9 月 29 日
コメント済み: 2NOR_Kh 2022 年 9 月 29 日
I wanna plot the equation given below for w=(3:0.01:7)*1e6 and the written values in the code, I should have a plot of R based on w but the R I calculated in the code is a number instead of a vector. which part I wrong?
this is the equation:
clear all;
close all;
z1=34e6;
z2=7.14e6;
z3=1.5e6;
l=8.355e-5;
c2=1673;
w=(3:0.01:7)*1e6;
[m,n]=size(w);
R=((1-z1/z3)*cos(l.*w/c2) + 1j*(z2/z3-z1/z2)*sin(l.*w/c2))/((1+z1/z3)*cos(l.*w/c2) + 1j*(z2/z3+z1/z2)*sin(l.*w/c2));
plot(w,abs(R));

採用された回答

Walter Roberson
Walter Roberson 2022 年 9 月 29 日
You used the / operator. The / operator is matrix division. P/Q is approximately P*pinv(Q) . In situations such as yours with row vector P and Q, P/Q is approximately a fitting operation. The element-by-element division operator is ./
z1=34e6;
z2=7.14e6;
z3=1.5e6;
l=8.355e-5;
c2=1673;
w=(3:0.01:7)*1e6;
[m,n]=size(w);
R = ((1-z1/z3)*cos(l.*w/c2) + 1j*(z2/z3-z1/z2)*sin(l.*w/c2)) ./ ((1+z1/z3)*cos(l.*w/c2) + 1j*(z2/z3+z1/z2)*sin(l.*w/c2));
plot(w,abs(R));
  1 件のコメント
2NOR_Kh
2NOR_Kh 2022 年 9 月 29 日
thank u so much

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by