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 个评论
Walter Roberson
2019-3-24
What are some sample e and La values that it fails on ?
回答(1 个)
Walter Roberson
2019-3-24
编辑:Walter Roberson
2019-3-24
0 个投票
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!