Help with error using vpasolve!

Im trying to graph Euler curves of Material Resistances using the secant formula.
Curves that should look like this:
But instead I have some (I believe in my inocence and inexperience) "errors" on some points of my formula that make the graph look like this:
So the first part is actually correct, but clearly those spikes are not, and Im having a hard time pinpointing the error, the code is really basic:
"La" being the horizontal axis, and "X" the vertical one/ "e" are each different curve which is excentricity./"Tcr" is maximum tension
for j=1:length(e)
for i=1:length(La)
S=0;
Tcr=(pi()^2*190000)/(La(i)^2);
syms x;
S=vpasolve(x*(1+e(j)*sec((La(i)/2)*sqrt(x/190000)))==Tcr,x);
R(i)=S;
end
plot(La,R,'-')
end
I believe so much so, is not an error in the mathematics, but probably the coding or the functions used that spiral in the error.
HELP! please! Thanks for your suggestions!

1 Kommentar

Walter Roberson
Walter Roberson am 24 Mär. 2019
What are some sample e and La values that it fails on ?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 24 Mär. 2019
Bearbeitet: Walter Roberson am 24 Mär. 2019

0 Stimmen

Testing with a few values, it looks to me as if the equation has an infinite number of solutions (with the catch basins getting narrower and narrower with increasing La).
I suggest that each iteration, you use the previous solution as the initial guess for the vpasolve(). That should help but might not cure the problem completely.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 24 Mär. 2019

Bearbeitet:

am 24 Mär. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by