solve and vpasolve command doesn't work

32 views (last 30 days)
Hello,
I am trying to get a non zero solution of the equation ''delta'' for the variable ''P" with the following code but unable to get the solution by using solve and vpasolve command. I will highly appreciate if somone can help me.
clear all
syms P
%axis([0 2 0 0.0001])
E=200; h1=40; b=20; l=100; a=50; n=1;h0=50;
I0=b*h0^3/12; I1=b*h1^3/12;
L00=sqrt(P/(E*I0-P*n));
L0=simplify(L00);
L11=sqrt(P/(E*I1-P*n));
L1=simplify(L11);
delta1=(L1*sin(L0*a)*cos(L1*(l-a)))-(L0*cos(L0*a)*sin(L1*(l-a)));
delta=simplify(delta1);
F=vpasolve(delta,P)

Accepted Answer

John D'Errico
John D'Errico on 3 Apr 2019
Edited: John D'Errico on 3 Apr 2019
I always need to laugh when someone says solve does not work, yet they never invested any thought in what they were trying to make those tools do.
I'm not at all surprisd by the way, that solve fails, since it seems unlikely an analytical solution is available for this.
So why did vpasolve fail to do what you want? That just takes ONE thing. A plot.
fplot(delta)
grid on
xline(0);
subs(delta,0)
ans =
0
So it is clear that at delta==0, there is a solution.
vpasolve(delta)
ans =
0
Is there any other solution? It seems that if I force fplot to look over a much wider domain in x, this has the same fundamental shape. It is only when I push the limits on x, for example
fplot(delta,[-100000,100000])
Now it appears that it MIGHT be possible another solution exists. And vpasolve was supposed to know this how? Things seem to happen only for LARGE positive P.
fplot(delta,[0,10000000])
yline(0);
vpasolve(delta,1e6)
ans =
965748.2333617142707833134938588
vpasolve(delta,3e6)
ans =
3022435.2524207491946774838105101
vpasolve is a numerical solver. It often needs an intelligent starting value if you want to see a specific solution. Otherwise, you get pot luck. So, if you want vpasolve to work, then you need to give it even a chance to actually do what you want.
  2 Comments
HINA
HINA on 3 Apr 2019
Thank you so much for your time and support. your answer is very helpful for me to understand my problem.
Can you explain a bit more what is the difference between vpasolve(x) and matlabFunction(x) . Which is better to use in order to get the solution.
John D'Errico
John D'Errico on 8 Apr 2019
matlab Functino is NOT a rootfinding solver. It merely creates a function from a symbolic object, that can be then evaluated.
A solver, like vpasolve, is a root finder. Like fzero, or fsolve, but the latter work on double precision arguments. vpasolve is for symbolic objects only.

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!