HW6_Campos_Tyler

# HW6_Campos_Tyler - 14W-CF 02/23/2011 HW6 Campos, Tyler...

This preview shows pages 1–4. Sign up to view the full content.

Scholar: HW6 Problem 1 Problem: Prepare an algorithm to determine the surface area and volume of a single right circular cone for given values of height and diameter. Write the MATLAB function for your algorithm. Diagram: Solution: Flowchart Start Identify variables (height,diameter) R=d/2 SA=(pi*r*sqrt(r^2 + h^2)) + (pi+r^2) Vol=(1/3)*pi*(r^2)*h Input Height and diameter (h,d) End Output: Surface Area Volume of cone 14W-CF 02/23/2011 HW6 Campos, Tyler 1/5 Wednesday, February 23, 2011 1:12 PM HW6 Page 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
MATLAB Code: function [ SA,Vol ] = hw6q1( h,d ) %Surface Area and volume of a cone % Using the derived equations, the inputs of diameter and height will yield outputs of Surface % area and volume. r = d / 2; SA=(pi*r*sqrt(r^2 + h^2)) + (pi+r^2); Vol=(1/3)*pi*(r^2)*h; end Sample Run: >> [SA, Vol]=hw6q1(pi,5) SA = 40.9247 Vol = 20.5617 Discussion: This function was very simple to write and is much easier than the code we used in the past. Virtually no complications. 14W-CF 02/23/2011 HW6 Campos, Tyler 2/5 Wednesday, February 23, 2011 1:13 PM HW6 Page 2
Scholar: HW6 Problem 2 Problem:

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

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

### Page1 / 5

HW6_Campos_Tyler - 14W-CF 02/23/2011 HW6 Campos, Tyler...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online