Programming 1-2

Programming 1-2 - G=pi/N; Ab=((0.5*W)^2)/(tan(G))*N;...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
14W EngE1114 Programming HW 16/10/06 Park, Jungsun / % this function is to calculate the volume and surface area of a prism with % regular polygon cross-section when it recieves the number of sides (N), % the side length (W), and the prism length (L). % Call statement: [S,V] = POLY_PRISM(N,W,H) function [SA, V]=POLY_PRISM(N,W,H)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: G=pi/N; Ab=((0.5*W)^2)/(tan(G))*N; As=W*N*H; V=Ab*H; SA=2*Ab+As; >> [SA,V]=POLY_PRISM(6,1,3) SA = 23.1962 V = 7.7942 >> [SA,V]=POLY_PRISM(3,1,3) SA = 9.8660 V = 1.2990 >> [SA,V]=POLY_PRISM(8,0.5,10) SA = 42.4142 V = 12.0711 START INPUT N,W,H Ab=((W/2)^2/tan(G/N))N As=N*W*H Vt=Ab*H At=2*Ab+As OUTPUT Vt, AT STOP...
View Full Document

This note was uploaded on 03/19/2008 for the course ENGE 1114 taught by Professor Twknott during the Fall '06 term at Virginia Tech.

Ask a homework question - tutors are online