# vpasolve accuracy in two equations with two variables

6 views (last 30 days)
sason yaakov bochnick on 22 Sep 2022
Commented: Star Strider on 28 Sep 2022
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 CommentsShowHide 1 older comment
sason yaakov bochnick on 28 Sep 2022
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])

Sign in to comment.

### Accepted Answer

Star Strider on 22 Sep 2022
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 CommentsShowHide 7 older comments
Star Strider on 28 Sep 2022
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Sign in to comment.

### Categories

Find more on Calculus in Help Center and File Exchange

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by