I can't find solution with solve fuction
조회 수: 1 (최근 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!