E7_Lab04_Solutions_Fall_2010

E7_Lab04_Solutions_Fall_2010 - Contents Problem 1 Problem 2...

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

Contents Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Problem 7 Problem 8 Problem 9 % name % SID % lab section % Lab Assignment 4 format compact Problem 1 [celsius kelvin] = temp_conv([-459.67 -40 32 68 212 10340]) type temp_conv celsius = 1.0e+003 * -0.2732 -0.0400 0 0.0200 0.1000 5.7267 kelvin = 1.0e+003 * 0 0.2332 0.2732 0.2932 0.3732 5.9998 function [C K] = temp_conv(T_F) C = 5/9*(T_F - 32); K = 5/9*(T_F + 459.67); Problem 2 V = my_cylinder(5,15) V = my_cylinder(2,[20 25 30]) radii = linspace(0.5,3,100); heights = linspace(5,50,100); [volumes, areas] = my_cylinder(radii,heights); plot(volumes, 'r' ) hold on plot(areas, 'b' ) title( 'Volume and Surface Area' ) legend( 'volumes' , 'surface areas' ) type my_cylinder V = 1.1781e+003 V = 251.3274 314.1593 376.9911 function [volume, surf_area] = my_cylinder(r,h) volume = pi*r.^2.*h;

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

View Full Document
Problem 3 Str1 = ReplaceChar( 'matlab: matrix laboratory' , 'a' , 'A' ) Str2 = ReplaceChar( 'Roll on you Bears' , 'a' , 'e' ) Str3 = ReplaceChar( 'PAC 10' , '0' , '2' ) type ReplaceChar Str1 = mAtlAb: mAtrix lAborAtory Str2 = Roll on you Beers Str3 = PAC 12 function strOut = ReplaceChar(InStr, char1, char2) InStr(strfind(InStr,char1)) = char2; strOut = InStr; Problem 4 format bank TOTAL = 20e3; downPayment = TOTAL*0.1;
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 01/21/2011.

Page1 / 6

E7_Lab04_Solutions_Fall_2010 - Contents Problem 1 Problem 2...

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

View Full Document
Ask a homework question - tutors are online