This preview shows page 1. Sign up to view the full content.
Unformatted text preview: BIL108E IntroductiontoScientificandEngineeringComputing Homework1 Spring10 1. The diagram to the right shows an oval tank that might be used to contain home heatingoil.Thevolumeofthetankis V=LAend ,where Aend =!R 2 +2RH istheareaofthe endofthetank.Thesurfaceareaofthetankis As =2Aend + 2!R+2H L . i. Write a Matlab function to compute the volumeofthetankasafunctionofL.Assume that R = 2 and H = 1.5, i.e., assign these fixed values to variables in the function. Do not printthevalueofVinthefunction.Returnthe value of V as an output parameter of the function. ii. Extend the Matlab function obtained in the preceding exercise so that L, R, and H are all inputstothefunction. iii. Extend the Matlab function obtained in the preceding exercise so that V and As are returnedfromthefunction. 2.Writeanmfilethatreturnstheplotof y = 5 k 0.5 overtherange 1 k 5 indiscrete incrementsof k = 0.5 aslongas y < 8 .Donotforgettolabelthegraph. 3.Theelectricityaccountsofresidentsinaverysmalltownarecalculatedasfollows: if500unitsorlessareusedthecostis2centsperunit; if more than 500, but not more than 1000 units are used, the cost is $10 for the first500units,andthen5centsforeveryunitinexcessof500; if more than 1000 units are used, the cost is $35 for the first 1000 units plus 10 centsforeveryunitinexcessof1000; inaddition,abasicservicefeeof$5ischarged,nomatterhowmuchelectricityis used. Writeaprogramwhichentersthefollowingfiveconsumptionsintoavector,anduses aforlooptocalculateanddisplaythetotalchargeforeachone:200,500,700,1000, 1500. ( ) Due Date: March 15, 2010 ...
View Full Document
- Spring '09