Clear Filters
Clear Filters

how can i plot the values of 2 variables against eachother from the determinant of a martix when det ==0?

2 views (last 30 days)
I am trying to plot the answers for variables o and e from my code when the det of my matrix ==0. when i use solve i get struct results back that i cannot seem to plot.
syms e o n
c=0;
g(n)=e/(2*(o+(1i*n*c)-((n)^2)));
f=[1 g(3) 0 0 0 0 0; g(2) 1 g(2) 0 0 0 0; 0 g(1) 1 g(1) 0 0 0; 0 0 g(0) 1 g(0) 0 0; 0 0 0 g(-1) 1 g(-1) 0; 0 0 0 0 g(-2) 1 g(-2); 0 0 0 0 0 g(-3) 1];
F=det(f)==0;
solo=solve(F, o, 'ReturnConditions', true);
sole=solve(F, e, 'ReturnConditions', true);

Accepted Answer

John D'Errico
John D'Errico on 16 Jun 2020
Edited: John D'Errico on 16 Jun 2020
First, need I point out just how bad of an idea is it to name a variable a lower case o? This is just asking to produce buggy code, when you misread or mistype o as 0.
Regardless, Just set
F = det(F);
If you look at F, you will see it is essentially a high degree (greater than 4 is all that matters) polynomial. So algebraic solutions will often be difficult to find.
Then use fimplicit to plot the solution locus. Settign it to zero does not help. In fact that will cause problems, and fimplicit does that implicitly anyway.
fimplicit(F)
xlabel 'e'
ylabel 'o'
The solo and sole calls to solve do nothing useful, since no algebraic solutions will generally be found.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!