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

function [vol,surfarea] = torus_yourlogin(radius_a,radius_b) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Programmer(s) and Purdue Email Address(es): % 1. ENGR Faculty/Staff % % Section #: ALL % % Assignment #: Homework 3 Problem 5 % % Academic Integrity Statement: % % I/We have not used source code obtained from % any other unauthorized source, either modified % or unmodified. Neither have I/we provided access % to my/our code to another. The project I/we am/are % submitting is my/our own original work. % % torus_yourlogin: calculates the volume and surface area of a torus given the inner and outer radii. % INPUTS: List them below one line per input argument % radius_a - inner radius (units of length)
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % radius_b - outer radius (units of length) % OUTPUTS: List them below line per output argument % vol - torus volume (units of length^3) % surfarea - torus surface area (units of length^2) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % ---- INPUTS ----% % ---- CALCULATIONS ----vol = 0.25*pi^2*(radius_a + radius_b)*(radius_b - radius_a)^2; % Calculates the volume (units of length^3) v surfarea = pi^2*(radius_b^2 - radius_a^2); % Calculates the surface area (units of length^2) l % ---- RESULTS: -----% % part i. % >>[v,sa]=torus_yourlogin(1,2) % % v = 7.4022 % sa = 29.6088 % % part ii. % >>[v,sa]=torus_yourlogin(7,13) % % v = 1.7765e+003 % sa = 1.1844e+003 %...
View Full Document

## This note was uploaded on 05/02/2011 for the course ENGR 132 taught by Professor Kutson during the Spring '11 term at Purdue.

Ask a homework question - tutors are online