Empty sym: 0-by-1
10 views (last 30 days)
Show older comments
clc
clear all
close all
syms x1 x2 x3 x4 t
tspan=[0 100];
[solx1 solx2 solx3 solx4] = solve([-x1+x2==0,-x1+x2.*x3+(0.0001+0.0001*x4.^4).*x2==0,1-x2.^2==0,x2==0], [x1, x2, x3, x4])
x1val=vpa(solx1)
x2val=vpa(solx2)
x3val=vpa(solx3)
x4val=vpa(solx4)
E1=[x1val(1,:),x2val(1,:),x3val(1,:),x4val(1,:)]
E2=[x1val(2,:),x2val(2,:),x3val(2,:),x4val(2,:)]
E3=[x1val(3,:),x2val(3,:),x3val(3,:),x4val(3,:)]
J=jacobian([-x1+x2,-x1+x2.*x3+(0.0001+0.0001*x4.^4).*x2,1-x2.^2,x2], [x1, x2, x3, x4])
J1=subs(J,{x1,x2,x3,x4},{E1(1,:)});
eigE1=round(vpa(eig(J1)),4)
J2=subs(J,{x1,x2,x3,x4},{E2(1,:)});
eigE2=round(vpa(eig(J2)),4)
J3=subs(J,{x1,x2,x3,x4},{E3(1,:)});
eigE3=round(vpa(eig(J3)),4)
0 Comments
Answers (1)
John D'Errico
on 26 Nov 2022
Edited: John D'Errico
on 26 Nov 2022
Don't write a whole mess of code, withput actually thinking about whether virtially the very first (significant) line you write produces a viable result.
syms x1 x2 x3 x4 t
tspan=[0 100];
[solx1 solx2 solx3 solx4] = solve([-x1+x2==0,-x1+x2.*x3+(0.0001+0.0001*x4.^4).*x2==0,1-x2.^2==0,x2==0], [x1, x2, x3, x4])
So now look carefully at the equations you have written. I'll spread them out into 4 lines:
-x1+x2==0 (1)
-x1+x2.*x3+(0.0001+0.0001*x4.^4).*x2==0 (2)
1-x2.^2==0 (3)
x2==0 (4)
Consider the last equation. That tells you that x2 == 0.
OOPS. Look at the third equation. From that if x2==0, is there a solution? That can only happen when 1==0, and from what I recall of mathematics, that is a rare event.
Seriusly, NO! Not ever. Never. Nada. Nil. Not gonna happen.
No solution exists for this system. Now, look back at what solve told you. Empty sym. I would look far more carefully at the problem you are trying to solve. Revisit how you generated these equations.
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements 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!