필터 지우기
필터 지우기

vpasolve accuracy in two equations with two variables

조회 수: 6 (최근 30일)
sason yaakov bochnick
sason yaakov bochnick 2022년 9월 22일
댓글: Star Strider 2022년 9월 28일
I got two massive equations with two variables, and vpasolve can not find the solution because that commend search for an accurate answer, which does not exist. I want to get the nearest value of the variables that solve the equations. For example, I am satisfied with 90% accurate solutions.
can I add an accurate aspect in the commend vpasolve?
if not, what command or simple method can I use?
  댓글 수: 2
Torsten
Torsten 2022년 9월 22일
The enhanced accuracy in contrast to other methods is never the reason why vpasolve fails to find a solution.
To get a useful answer from the forum, we have to see your equations.
sason yaakov bochnick
sason yaakov bochnick 2022년 9월 28일
Hey! here's the code I used.
The abs_sqr_S11_Zin_1 and abs_sqr_S11_Zin_2 are measured values.
Also,x1,2 and y1,2 are measured values
clear all;close all;clc
%%
syms Z_0
Z_0 = 50
x1 = 0.000365
y1 = 0.51
x2 = 3.51
y2 = 0.8
%%
syms I_L R_L
R_1 = ((Z_0^3)*x1+(Z_0^2)*R_L*x1^2+(Z_0)^2*R_L*y1^2+(Z_0)^2*R_L+Z_0*R_L^2*x1+Z_0*I_L^2*x1)/((Z_0+R_L*x1-I_L*y1)^2+(R_L*y1+I_L*x1)^2 )
pretty(R_1)
I_1 = ((Z_0)^3*y1-(Z_0)^2*I_L*x1^2-(Z_0)^2*I_L*y1^2+(Z_0)^2*I_L-Z_0*R_L^2*y1-Z_0*I_L^2*y1)/(((Z_0+R_L*x1-I_L*y1)^2+(R_L*y1+I_L*x1)^2 ))
pretty(I_1)
%%
R_2 = ((Z_0^3)*x2+(Z_0^2)*R_L*x2^2+(Z_0)^2*R_L*y2^2+(Z_0)^2*R_L+Z_0*R_L^2*x2+Z_0*I_L^2*x2)/((Z_0+R_L*x2-I_L*y2)^2+(R_L*y2+I_L*x2)^2)
pretty(R_2)
I_2 = ((Z_0)^3*y2-(Z_0)^2*I_L*x2^2-(Z_0)^2*I_L*y2^2+(Z_0)^2*I_L-Z_0*R_L^2*y2-Z_0*I_L^2*y2)/(((Z_0+R_L*x2-I_L*y2)^2+(R_L*y2+I_L*x2)^2 ))
pretty(I_2)
%%
Zin_1 = R_1+j*I_1
Zin_2 = R_2+j*I_2
%%
%|S11_Zin1 |^2=|(Z_in1-Z_0)/(Z_in1+Z_0 )|^2
syms abs_sqr_S11_Zin_1
abs_sqr_S11_Zin_1=(abs((Zin_1-Z_0)/(Zin_1+Z_0)))^2
%abs_sqr_S11_Zin_1=((R_1-50)^2+I_1^2)/((R_1+50)^2+I_1^2 )
pretty(abs_sqr_S11_Zin_1)
%%
%|S11_Zin2 |^2=|(Z_in2-Z_0)/(Z_in2+Z_0 )|^2
syms abs_sqr_S11_Zin_2
abs_sqr_S11_Zin_2=(abs((Zin_2-Z_0)/(Zin_2+Z_0)))^2
pretty(abs_sqr_S11_Zin_2)
%%
Y = solve(abs_sqr_S11_Zin_1==0.192,abs_sqr_S11_Zin_2==0.0941,[R_L,I_L])

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2022년 9월 22일
I am not certain what problem you are having.
One option is to solve the equations and then use vpa on the solutions.
Example —
syms x
Eqn = x^5 + 2*x^4 + 10*x^3 - 3*x^2 - 110*x + 1
Eqn = 
xs = solve(Eqn,x)
xs = 
xsn = vpa(xs)
xsn = 
.
  댓글 수: 8
sason yaakov bochnick
sason yaakov bochnick 2022년 9월 28일
ok thank you very much for everything! your answers help me a lot!!
Star Strider
Star Strider 2022년 9월 28일
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by