I can't find solution with solve fuction
2 ビュー (過去 30 日間)
古いコメントを表示
Literally I can't find the solution with my code, which use 'solve' function to find solution of two equation.
The sol struct is filled with x(which is nowhere in my code) with this error message.
"Unable to convert expression into double array."
The code is below!
Is it because the equation itself is too complex?
How can I do for this?
S21_dB = -3.4964;
S21_deg = 2.1936;
syms er tanL positive;
assume(er, 'real');
assumeAlso(tanL, 'real');
assumeAlso(er<20 );
assumeAlso(tanL < 0.1 );
c = 3*10^8 ;
d = 731 *(10^-6);
f= 75*10^9;
lam = c./f;
w= 2*pi*f;
u_0 = 4*pi*(10^-7);
e_0 = 8.8541*(10^-12);
ec = er.*(1-1i*tanL);
z_0 = sqrt(u_0/(e_0));
z_d = sqrt(u_0/(e_0.*ec));
r = ((2*pi)/lam)*sqrt(ec);
S21_M = ((z_d+z_0).^2 - (z_d-z_0).^2)./((exp(1i.*r.*d).*(z_d+z_0).^2)- (exp(-1i*r*d).*(z_d-z_0).^2));
S21dB_M = real(20*log10(S21_M));
S21deg_M = real(angle(S21_M));
eqn1 = S21_dB- S21dB_M == 0;
eqn2 = S21_deg- S21deg_M == 0;
sol = solve([eqn1 eqn2],[er tanL],'ReturnConditions',true);
eps = double(sol.er);
losst = double(sol.tanL);
sol.er
3 件のコメント
採用された回答
madhan ravi
2018 年 12 月 11 日
編集済み: madhan ravi
2018 年 12 月 11 日
You are solving system of non-linear equations so use fsolve()
S21_dB = -3.4964;
S21_deg = 2.1936;
syms er tanL real;
assumeAlso(er<20 );
assumeAlso(tanL < 0.1 );
c = 3*10^8 ;
d = 731 *(10^-6);
f= 75*10^9;
lam = c./f;
w= 2*pi*f;
u_0 = 4*pi*(10^-7);
e_0 = 8.8541*(10^-12);
ec = er.*(1-1i*tanL);
z_0 = sqrt(u_0/(e_0));
z_d = sqrt(u_0/(e_0.*ec));
r = ((2*pi)/lam)*sqrt(ec);
S21_M = ((z_d+z_0).^2 - (z_d-z_0).^2)./((exp(1i.*r.*d).*(z_d+z_0).^2)- (exp(-1i*r*d).*(z_d-z_0).^2));
S21dB_M = real(20*log10(S21_M));
S21deg_M = real(angle(S21_M));
[tanL,er]=fsolve(@rootss,[10,10])
function eqn=rootss(x)
tanL=x(1);
er=x(2);
eqn=[20*real(log((((-777820666600722137088/(5480422450918343*er*(- 1 + tanL*1i)))^(1/2) - 6627542629724307/17592186044416)^2 - ((-777820666600722137088/(5480422450918343*er*(- 1 + tanL*1i)))^(1/2) + 6627542629724307/17592186044416)^2)/(exp(-(pi*(-er*(- 1 + tanL*1i))^(1/2)*842785619867605125i)/2305843009213693952)*((-777820666600722137088/(5480422450918343*er*(- 1 + tanL*1i)))^(1/2) - 6627542629724307/17592186044416)^2 - exp((pi*(-er*(- 1 + tanL*1i))^(1/2)*842785619867605125i)/2305843009213693952)*((-777820666600722137088/(5480422450918343*er*(- 1 + tanL*1i)))^(1/2) + 6627542629724307/17592186044416)^2))/log(10));
angle((((-777820666600722137088/(5480422450918343*er*(- 1 + tanL*1i)))^(1/2) - 6627542629724307/17592186044416)^2 - ((-777820666600722137088/(5480422450918343*er*(- 1 + tanL*1i)))^(1/2) + 6627542629724307/17592186044416)^2)/(exp(-(pi*(-er*(- 1 + tanL*1i))^(1/2)*842785619867605125i)/2305843009213693952)*((-777820666600722137088/(5480422450918343*er*(- 1 + tanL*1i)))^(1/2) - 6627542629724307/17592186044416)^2 - exp((pi*(-er*(- 1 + tanL*1i))^(1/2)*842785619867605125i)/2305843009213693952)*((-777820666600722137088/(5480422450918343*er*(- 1 + tanL*1i)))^(1/2) + 6627542629724307/17592186044416)^2))];
end
4 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!