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!