how to solve multi variable simultaneous equations

11 Ansichten (letzte 30 Tage)
Hedayat
Hedayat am 13 Nov. 2018
Beantwortet: Hedayat am 13 Nov. 2018
Hi all,
Please help me wiht this, I am new to matlab.
I want to solve two equattions which has five variable, so I want to provide ranges for three variables and get all the solutions.
3 variable with ranges are x4, x5 and z4, and I want to find corresponding solution for z5 and G. (Actually I have a formula which I nedd to equate with the real and imaginary part of a complex number)
I have tried this way-
x4=pi/36:pi/9:pi/2;
x5=pi/6:pi/9:pi/2;
z4=60:20:80;
for a=1:length(z4)
for b=1:length(x4)
for c=1:length(x5)
ZL=61.5-1i*47.4;
YL=1/ZL; % to be equated with its conjugate
GL=real(YL);
BL=imag(YL);
syms z5 real
syms z55 real
assume( z5 > 0)
syms G real
assume( G>0)
y4=1./z4;y5=1./z5;
ya(a,b)= -1i.*y4(a).*cot(x4(b)) % Formula -I
yb(c)=vpa((y5).*(G + 1i.*y5.*tan(x5(c)))./(y5+ 1i.*G.*tan(x5(c)))) %Formula-2
yeq(a,b,c)=ya(b)+yb(c) %sum
yeqR=real(yeq)
yeqI=imag(yeq)
eqn=[yeqR==GL, yeqI==-BL]
var=[G z5]
s=solve(eqn, var)
G1=s.G
z55=s.z5
end
end
end
  3 Kommentare
Hedayat
Hedayat am 13 Nov. 2018
Thanks KSSV,
below is the eqns, I have 5 variables and two eqns, so I have to assume 3 variables. (Later I will see if solutions are feasable or not)
ya= - i*y4*cot(x4)
yb= (y5 * (G+ i *y5* tan(x5))) / (y5+ i G* tan(x5) )
yeq=ya+yb
yL=1/(61.5-i*47.4)
Solve(yeq=yL*)
KSSV
KSSV am 13 Nov. 2018
What are the unknowns in the above? YOu can solve it with hand first..equate complex and real parts...and these two parts should be solved for unknowns.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Hedayat
Hedayat am 13 Nov. 2018
Thank you again KSSV,
I need values for G and y5, and I want to sweep y4,x4 and x5, as I mentioned in main post. it wil not always yield a desired solutions. For example, I need a value of y5 in the range of 20-120 and G>0. Plus,based on these results, I have to add other complicated equations that too have some constraints , and this is why I am avoiding hand calculations.

Community Treasure Hunt

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

Start Hunting!

Translated by