Empty sym: 0-by-1 : Don't understand why

조회 수: 1 (최근 30일)
Benoît
Benoît 2024년 11월 11일
댓글: Benoît 2024년 11월 11일
Hi,
I have the following problem :
I would like to solve this equation system but matlab doesn't find any solutions by sending the following message : Empty sym: 0-by-1
Do i need to adapt the code in a certain way or this system really doesn't have any solutions ?
Thank you for your help.
Regards,
Benoit
  댓글 수: 2
Bruno Luong
Bruno Luong 2024년 11월 11일
편집: Bruno Luong 2024년 11월 11일
Why there is the comma?
3,981
Post your code (using Insert a Line of Code button) not the screen shot
Walter Roberson
Walter Roberson 2024년 11월 11일
The comma is causing the problem. You are effectively creating four equations,
3
981==EXPRESSION
10*pi==EXPRESSION
6283185.307==EXPRESSION
The first of those expressions, 3, cannot be solved to be equal to zero, so the solve() fails.

댓글을 달려면 로그인하십시오.

채택된 답변

Torsten
Torsten 2024년 11월 11일
편집: Torsten 2024년 11월 11일
I multiplied by the denominators and squared to get rid of the square roots.
Your system seems to have 4 (complex-valued) solutions.
syms Cs C2 Rl
R1 = 1000;
gm = 10;
eqns = [3.981*(gm*(2*Rl*C2+R1*Cs)+Cs) == gm*Rl*Cs*(1-gm*R1),...
(10*pi*(gm*(2*Rl*C2+R1*Cs)+Cs))^2==2*gm*Rl*C2*Cs*(gm*R1+1),...
6283185.307^2*(Rl*C2*Cs*(1+R1*gm))==2*gm];
S = solve(eqns,[Cs C2 Rl]);
format long
double(S.Cs)
ans =
1.0e-09 * 0.005065552626999 + 0.318237745447037i -0.005065552626999 - 0.318237745447037i 0.005065552626999 - 0.318237745447037i -0.005065552626999 + 0.318237745447037i
double(S.C2)
ans = 4×1
1.0e-04 * -0.125571466971436 0.125571466971436 -0.125571466971436 0.125571466971436
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
double(S.Rl)
ans =
-0.000201720156037 + 0.012672845866091i -0.000201720156037 + 0.012672845866091i -0.000201720156037 - 0.012672845866091i -0.000201720156037 - 0.012672845866091i
eqns_orig = [3.981 == gm*Rl*Cs*(1-gm*R1)/(gm*(2*Rl*C2+R1*Cs)+Cs),...
10*pi==(2*gm*Rl*C2*Cs*(gm*R1+1))^(1/2)/(gm*(2*Rl*C2+R1*Cs)+Cs),...
6283185.307==(2*gm/(Rl*C2*Cs*(1+R1*gm)))^(1/2)];
for i = 1:4
double(subs(eqns_orig,[Cs C2 Rl],[S.Cs(i) S.C2(i) S.Rl(i)]))
end
ans = 1×3
0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
ans = 1×3
0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
ans = 1×3
0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
ans = 1×3
0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
  댓글 수: 1
Benoît
Benoît 2024년 11월 11일
Thank for your answer.
It is now solving the system but i shouldn't be obtaining complex solutions so i think there is a problem in my equations.
But thanks for the correction.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by