Trying to solve 2 equations with 2 unknowns symbolically using MATLAB -
trying solve 2 equations 2 unknown using matlab , not liking input.
where c 3.06 + 2.57j, , v 12:
eq1 = 'c = a/10j' eq2 = '(6b)/50 + b/10j = a/10j + a/10'
trying solve , b. suggestions of how put these in?
matlab screwed up, syntax is
sol = solve(eq1,x1,eq2,x2,..);
it make more sense make solve({eq1,eq2,..},{x1,x2,..})
no, have write out arguments 1 one.
anyway trick eq1, eq2, .. symbolic expressions must evaluated zero. instead of c = a/10j
needs eq1=sym('c-a/10j')
so try this:
eq1 = sym('c - a/(10*i)'); % must evaluate 0 eq2 = sym('(6*b)/50 + b/(10*i) -( a/(10*i) + a/10)'); %must evaluate 0 sol = solve(eq1,'a',eq2,'b'); = subs(sol.a,'c',3.06+2.57j) b = subs(sol.b,'c',3.06+2.57j)
produces a= -25.7000 +30.6000i
, b=-20.6639 +29.6967i
.
note symbolic functions not understand 10j
. needs 10*i
. notatation 6b
missing operator , needs 6*b
.
good luck!
since problem linear there way solve it
equs = [eq1;eq2]; vars = [sym('a');sym('b')]; = jacobian(equs,vars); b = a*vars - equs; x = a\b; c = 3.06+2.57j; sol = subs(x,'c',c)
with results
sol = -25.7000 +30.6000i -20.6639 +29.6967i
Comments
Post a Comment