Symbolic Equation Solver- should work, but doesn't!

2 views (last 30 days)
Hi,
I have a matrix that includes terms using the symbol "s". I need the exponential of that matrix, and then the determinant of that, both in terms of s, which I then want to set equal to 0 to solve for s. For example:
syms s
F=[0,1,0,0;0,0,1,0;0,0,0,1;m*s^2/EI,0,0,0]
Y=vpa(expm(F))
Step2=det(4*Y)
So now I have a long equation in terms of the symbol s. According to the mathworks website http://www.mathworks.com/help/toolbox/symbolic/brvfu8o-1.html , I should be able to do this:
"Algebraic Equations with One Symbolic Variable
Use the double equal sign (==) to define an equation. Then you can solve the equation by calling the solve function. For example, solve this equation:
syms x
solve(x^3 - 6*x^2 == 6 - 11*x)
ans =
1
2
3"
So I've defined s as a symbol, but when I use solve(Step2==0,s)
it gives me an error- essentially that symbol can't be used in a logic expression?
So what's the deal? Anyone have any idea why it isn't working? Thanks!!! Kaitlin

Accepted Answer

Walter Roberson
Walter Roberson on 14 Mar 2012
Just use
solve(Step2,s)
Note: the vpa() step probably is not doing you much good for accurate solutions. It might possibly make the solution faster, though.
  2 Comments
Kaitlin
Kaitlin on 14 Mar 2012
That did work- it gives me the answer like this:
matrix([[-4045518.22etc]))
So is it only finding one root? I want to find several roots- maybe I will have better luck plotting the system or something...
Walter Roberson
Walter Roberson on 14 Mar 2012
I ran the above through Maple, and it says that (barring division by 0 or getting infinities involved), that Step2 will always be 256 .
I confirm that Maple's LinearAlgebra[MatrixExpontential] agrees numerically in test cases against MATLAB's expm().
In the symbolic case of your F, the matrix exponential leads to sin() and cos() equations multiplied by various terms. The determinant of 4 times that matrix comes down to 256 * V1 * V2 * (sin^2(V3) + cos^2(V3)) in form, and of course the sin^2+cos^2 combine to 1. And it happens that the V1 and V2 in the form are exp() of the same expressions except one with + sign and the other with - sign, so the two multiply together to give precisely 1. The only thing left is the 256.
This is completely independent of the s, M, and EI, provided that none of those introduce singularities.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!