CodeCodeCode

ENGR132: HW02 - c1b_ups_pkgvol

Mar 30th, 2011
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.63 KB | None | 0 0
  1. % --- INPUTS ---
  2. max_size = 165;                 % maximum girth (inches)
  3. package_length = [35:10:105];   % package length (inches)
  4.  
  5. % --- CALCULATIONS ---
  6. package_side = (max_size - package_length)./4;    % calculates length of a side (inches)
  7. package_volume = package_length.*package_side.^2; % calculates volume (cubic inches)
  8.  
  9. % --- OUTPUTS ----
  10. % Commands below create a plot of package volume as a function of package
  11. % length
  12. plot(package_length,package_volume)
  13. title('Maximum volume of a UPS package as a function of its length')
  14. xlabel('Length of a package being shipped (in)')
  15. ylabel('Maximum package volume (cu in)')
Advertisement
Add Comment
Please, Sign In to add comment