clear;close all;
format rat;
% Note: all units are in inches
pw = 1 + 5/8; % post width
ms = 3+15/16; % maximum space
rl = 59.5; % actual rail length
ps = pw+ms; % minimum post spacing
erl = rl + pw; % effective rail length, since rail thickness not present on each end
np = ceil(erl/ps); % minimum number of posts+1, rounded up to nearest whole number
aps = erl/np; % actual post spacing determined by whole number of posts
i = (aps-pw/2):aps:rl; % This is a vector containing the floating point measurements
x = round(i*16)/16; % Rounded to nearest 16th of an inch
y = floor(x); % The whole number
z = (x - y); % The decimal. Should appear as a fraction
total = [y' z'] % Output
Thursday, August 17, 2006
The few people that read this blog may remember that my wife and I are engaged in the "landscaping project from hell," part of which has been to replace our deck. My wife asked me to calculate the places to drill the holes to mount the posts between the rails such that all the gaps between the posts are the same and no more than 3 and 15/16 inches (per county building code). Below is the Matlab program I wrote to make this calculations, given the length of the rail (rl), the thickness of the posts (pw), and the maximum space between the posts (ms):
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment