ploting a 'complete' catenary curve by using a solver
7 次查看(过去 30 天)
显示 更早的评论
Hi,
the ODE for the catenary curve can be expressed as: y'' = a*sqrt(1+(y'^2))
If I transform this quation to a MATLAB ODE system to be solved by one of the ODE solvers I get something like:
function [ dy] = catenary_curve( x, y )
a = 1;
dy(1,1) = y(2);
dy(2,1) = a*sqrt(1+(y(2)^2));
end
[x,y] = ode45('catenary_curve',[0,2],[0 0]);
If I solve this equation I always get only the right branch of the catenary curve. I guess the reason is that there is no x in the ODE equation and therefore it always starts at the lowest point of the curve. Does anyone has an idea how I should setup my function file or my command window commands to get also the left branch of the curve?
The same questions applies to a Simulink representation. It is easy to model the equation. However the output for y(x) is always only the right branch.
Best Regards
Markus
0 个评论
回答(1 个)
Roger Stafford
2013-6-20
As you have written the differential equation with the given initial conditions and with x increasing from 0 to 2, there is no other "branch". The solution is uniquely determined. With a = +1 it is
y = cosh(x)-1
and nothing else.
You would get a different solution if you took the negative of the square root or if you set a equal to minus one - that is, if your differential equation were:
(y")^2 = 1 + (y')^2
and you chose the negative root for y". Or, if x was set to decrease from 0 to -2, the solution would of course be different.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!