Asked by Stella Banou
on 17 Oct 2019 at 15:54

Hello,

I am trying to solve this simple system:

freq = 100000;

epsilon = 1119.2;

sigma = 0.00045128;

syms x y

eq1=x-1i*y==1119.2;

eq2=(2*pi*freq*y+sigma)/(2*pi*freq*x)==0.07248;

eqns=[eq1 eq2];

S=solve(eqns, [x,y]);

I keep getting the error:

One or more output arguments not assigned during call to "varargout".

I have ran out of options on trouble shooting this. It is a system of two equations and two unknowns written exactly like the example for the solve function. Any ideas?

Answer by Sulaymon Eshkabilov
on 17 Oct 2019 at 16:26

Hi,

Your code's problem is that you are using this code inside your function file. Here is the corrected code:

function Solution = MY_fun101

freq = 100000;

epsilon = 1119.2;

sigma = 0.00045128;

syms x y

eq1=x-1i*y==1119.2;

eq2=(2*pi*freq*y+sigma)/(2*pi*freq*x)==0.07248;

eqns=[eq1 eq2];

S=solve(eqns, [x,y]);

Solution = double([S.x, S.y]);

end

Note that the output variable Solution is defined inside the code that was the error in your code.

Good luck.

KALYAN ACHARJYA
on 17 Oct 2019 at 16:34

freq = 100000;

epsilon = 1119.2;

sigma = 0.00045128;

syms x y

eq1=x-1i*y==1119.2;

eq2=(2*pi*freq*y+sigma)/(2*pi*freq*x)==0.07248;

eqns=[eq1 eq2];

S=solve(eqns, [x,y]);

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 2 Comments

## Walter Roberson (view profile)

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/485930-system-equation-solve-error#comment_757430

## KALYAN ACHARJYA (view profile)

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/485930-system-equation-solve-error#comment_757444

Sign in to comment.