solving complex matrix with symbolic variables
Show older comments
hello, I am trying to solve a complex matrix with symbols, but it returns''Empty sym: 0-by-1''. I would like to know why this happened and how could I solve this problem. Thank you.
Accepted Answer
More Answers (2)
As per my understanding, you're trying to solve a complex matrix equation in MATLAB
Well, I was going through your code, it is all correct. But, here you're trying to solve a problem, which contains 4 equations and 9 variables which is not possible. That's why you're getting an error here.
syms a b c d e f g h k real
z1=-30j;
z2=0.08+0.40j;
z3=-35j;
z4=0.10+0.50j;
z5=0.10+0.50j;
z6=-25j;
z7=0.30j;
p1=a;
p2=-0.55;
p3=-0.30;
p4=0.50;
q1=1j*b;
q2=-0.15j;
q3=-0.20j;
q4=1j*c;
e1=1.05;
e2=d;
e3=e;
e4=f;
f1=0j;
f2=1j*g;
f3=1j*h;
f4=1j*k;
y11=1/z1+1/z2+1/z5;
y12=(-1)*1/z2;
y13=(-1)*1/z5;
y14=0;
y21=y12;
y22=1/z2+1/z4+1/z3;
y23=(-1)*1/z4;
y24=0;
y31=y13;
y32=y23;
y33=1/z6+1/z7+1/z5+1/z4;
y34=(-1)*1/z7;
y41=y14;
y42=y24;
y43=y34;
y44=1/z7;
theta=f^2+k^2;
abs=1.1^2;
Y=[y11,y12,y13,y14;
y21,y22,y23,y24;
y31,y32,y33,y34;
y41,y42,y43,y44];
conjY=conj(Y);
V=[e1+f1;e2+f2;e3+f3;e4+f4];
format shortG
conjY=round(conjY,2,'significant');
Vscl=diag(V);
conjV=conj(V);
VIt=Vscl*conjY*conjV;
P=simplify([real([p1;p2;p3;p4]);imag([q1;q2;q3;q4]);theta])
Q=simplify([real(VIt);imag(VIt);abs])
sol=vpasolve(P==Q)
sol.a
sol.b
sol.c
sol.d
sol.e
sol.f
sol.g
sol.h
sol.k
error = arrayfun(@(i)subs(P-Q,[a b c d e f g h k],[sol.a(i) sol.b(i) sol.c(i) sol.d(i) sol.e(i) sol.f(i) sol.g(i) sol.h(i) sol.k(i)]),1:4,'UniformOutput',0)
error{1}
error{2}
error{3}
error{4}
Categories
Find more on Numeric Solvers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!













