system equation solve error

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?

2 件のコメント

Walter Roberson
Walter Roberson 2019 年 10 月 17 日
You should be using vpasolve() not solve()
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 10 月 17 日
No coding error in any case

サインインしてコメントする。

回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 10 月 17 日

0 投票

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.

1 件のコメント

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 10 月 17 日
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]);

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

製品

リリース

R2019a

質問済み:

2019 年 10 月 17 日

コメント済み:

2019 年 10 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by