Catenary at different height between 2 fixed points ?
69 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am making a script to write catenary at different height.
I do get a catenary with different height with the below code. The problem is the cable length is not what I set initially, it changes. For example, I set a cable length of 15 m and when I got the result, it was 37 meters. I am not sure whether there is a problem in finding curvature or I need to add a term x-x0 and find x0 while computing y for the catenary. If I had to compute x0, can you suggest me a way to do it ?
P.S - I have attached the function file to check arclength
%% catenary parameters
% end points
x1 = 0
y1 = 5
x2 = 10
y2 = 2
horizontal_diff_distance = abs(x1-x2);
vertical_diff_distance = abs(y1-y2);
L = 15; % total cable length, follows min length check L = sqrt(horizontal_diff_distance^2 + vertical_diff_distance^2)
%% find curvature 'a'for catenary at different height
d = horizontal_diff_distance;
v = vertical_diff_distance;
fun = @(a) (- L + (a * sinh((d/(2*a)) + atanh(v/L))) + (a * sinh((d/(2*a)) - atanh(v/L)))); x0 = 0.15;
a = abs(fzero(fun,x0));
%fun = @(a) (- l/2 + a * sinh(d/(2*a))); x0 = 5.0;
%a = abs(fzero(fun,x0));
%% plot catenary
x=x1:0.01:x2;
y= a*cosh(x/a);
plot(x,y),xlabel('x'),ylabel('y');
%% cross check length of cateanry
length = arclength(x, y,'spline');
disp(length)
2 commentaires
John D'Errico
le 6 Sep 2023
Modifié(e) : John D'Errico
le 6 Sep 2023
The simple catenary curve that you are generating, thus a*cosh(x/a) has no reason for it to pass through the two points you designate.
Check that.
x1 = 0;
y1 = 5;
x2 = 10;
y2 = 2;
horizontal_diff_distance = abs(x1-x2);
vertical_diff_distance = abs(y1-y2);
L = 15; % total cable length, follows min length check L = sqrt(horizontal_diff_distance^2 + vertical_diff_distance^2)
%% find curvature 'a'for catenary at different height
d = horizontal_diff_distance;
v = vertical_diff_distance;
fun = @(a) (- L + (a * sinh((d/(2*a)) + atanh(v/L))) + (a * sinh((d/(2*a)) - atanh(v/L)))); x0 = 0.15;
a = abs(fzero(fun,x0));
a
plot([x1,x2],[y1,y2],'o')
hold on
fplot(@(x) a*cosh(x/a),[x1,x2])
So why would you expect arclengths to be consistent between the curves, when they do not satisy the requirements?
Essentially, the basic curve, y=a*cosh(x/a) is probably some variation of catenary curve, between two points at fixed height. I'd need to check that claim, but it I'll accept that as true. But y1 and y2 are not at fixed heights, so that basic curve has nothing to do with this problem.
Réponses (2)
David Hill
le 6 Sep 2023
maximum a is minimum y. And the minimum cable length can be found using:
a=2;H=10;
minL=2*a*sinh(H/2/a)
Use cable length > minimum cable length
H=10;%horizontal
L=30;%cable length
v=3;%vertical
fun=@(a)2*a/H*sinh(H/2/a)-sqrt(L^2-v^2)/H;
a=fzero(fun,1)
DGM
le 8 Sep 2023
% input parameters
x0 = [0 10];
y0 = [5 2];
L = 15;
npoints = 100;
% initial calculations
dx = diff(x0);
dy = diff(y0);
xb = mean(x0);
yb = mean(y0);
% check for sane inputs
if L < sqrt(dx^2 + dy^2)
error('L is too short to span the distance at any tension')
end
% solve r = sinh(A)/A, for A>0
r = sqrt(L^2 - dy^2)/dx;
% these are the suggested initial estimates
if r<3
A0 = sqrt(6*(r-1));
else
A0 = log(2*r) + log(log(2*r));
end
A = fzero(@(A) sinh(A^2)./A^2 - r,A0)^2;
% catenary parameters
a = dx/(2*A);
b = xb - a*atanh(dy/L);
c = yb - L/(2*tanh(A));
% get point list
x = linspace(x0(1),x0(2),npoints);
y = a*cosh((x-b)/a) + c;
% plot the curve and specified endpoints
plot(x,y); hold on
plot(x0,y0,'o')
% verify arc length
length = arclength(x,y,'spline')
7 commentaires
DGM
le 10 Déc 2023
As Torsten has already mentioned, all the answers (and the original question) assumed the length as an input, and any other explanation for the code I provided is already available at the link I included.
The arclength() function used to verify the results is something that John wrote and OP included above in the original question.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!