how to solve multi variable simultaneous equations
11 views (last 30 days)
Show older comments
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 Comments
KSSV
on 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.
Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!