I'm finally getting around to making tarps for my kids. I see multiple references to catenary curve templates and generators here and elsewhere on the internet, but most of those seem to either be broken or don't produce printable templates. I put the attached Matlab script together to create printable pdf files that are all sized accurately. The sequence of pdfs can be printed, cut out, and taped together to create a single contiguous template for arbitrary catenary curve parameters (with some caveats: If the sag is larger than 10", it won't fit neatly on a single page). So is case there is anyone besides me out there that both use Matlab and want to generate catenary curve templates, here you go.
Unfortunately, I can't upload .m files, so I'll drop the text of the script inline:
Code:
%%% Specify Catenary Parameters
h = 6; % sag
H = 60; % width between catenary endpoints
unitsStr = 'inches'; % units for sag and width - options are {'inches','centimeters'}
%%% Output pdf file parameters
pdfFilename = '.\catCurve';
plotWidth = 9; % width of single plot on page (in current units)
pageOrientation = 'landscape'; % options are {'landscape', 'portrait'}
% The following code computes the catenary curve matching the inputs
aGuess = H^2 / (8*h);
a = fzero(@(x)(2*x*acosh((h+x)/x)-H), aGuess);
x = -(H/2):0.1:(H/2);
y = h + a - a*cosh(x/a);
% Create plots sized appropriately to fit the specified page width
p0 = min(x);
curPlt = 1;
while p0 < (H/2)
figure; plot(x,y,'LineWidth',2);
% force axes to have the correct size
axis equal; grid on;
xlim([p0,p0+plotWidth]);
ylim([0,h]);
set(gca,'LooseInset',get(gca,'TightInset'));
set(gcf,'units',unitsStr,'position',[1,1,plotWidth,h]);
axesPos = get(gca,'Position');
set(gcf,'position',[1,1,plotWidth/axesPos(3),h/axesPos(4)]);
% print current figure to pdf
set(gcf,'PaperOrientation',pageOrientation);
set(gcf,'PaperPositionMode','auto');
newFname = sprintf('%s%d.pdf', pdfFilename, curPlt);
print(newFname, '-dpdf');
close(gcf);
fileList{curPlt} = newFname;
p0 = p0 + plotWidth;
curPlt = curPlt + 1;
end
Bookmarks