which part of my logic is wrong?
1 回表示 (過去 30 日間)
古いコメントを表示
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));
0 件のコメント
採用された回答
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));
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!