Filter löschen
Filter löschen

vpasolve accuracy in two equations with two variables

6 Ansichten (letzte 30 Tage)
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 Kommentare
Torsten
Torsten am 22 Sep. 2022
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 am 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])

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 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 Kommentare
sason yaakov bochnick
sason yaakov bochnick am 28 Sep. 2022
ok thank you very much for everything! your answers help me a lot!!
Star Strider
Star Strider am 28 Sep. 2022
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by