Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MAEt215:tIntroductionttotProgrammingtintMATLAB SummertBt2016 HomeworktAssignmentt#3 Due:tTuesday,tJulyt19thtbyt11.59tpm Submission Instructions: Your solutions to this assignment must be typed and neatly presented. Unorganized solutions and/or solutions that do not present

MAE\t215:\tIntroduction\tto\tProgramming\tin\tMATLAB Summer\tB\t2016 Homework\tAssignment\t#3 Due:\tTuesday,\tJuly\t19th\tby\t11.59\tpm Submission Instructions: Your solutions to this assignment must be typed and neatly presented. Unorganized solutions and/or solutions that do not present the required deliverables will not be graded and receive a score of zero. This assignment is to be submitted,\tin\tPDF\tformat,\tto\tthe\tassignment\tlink\ton\tblackboard\tby\tthe\tdeadline. Students\twho\tobtain\ta\tscore\tof\t80%\tor\tgreater\ton\tproblem\t#3\twill\treceive\tcredit\tfor\toutcome #2:\tstudents\twill\tCreate\tMATLAB\tscripts\tand\tuser-defined\tfunctions. 1.\t[10\tpts]\tRevisiting\tMATLAB\tmatrices\tand\tbuilt-in\tfunctions. a) Factor\tthe\tfollowing\tpolynomials\tusing\tMATLAB: i. ! + 18 + 81 ii. ! + 11 + 24 iii. ! 10 + 9 iv. ! 4 ! + 4 16 v. 2 ! 16 40 b) Multiply the following vectors using \"dot\" multiplication. What does this type of operation\tdo\tin\tcontrast\tto\ttraditional\tmatrix\tmultiplication? i. [5,6,9]'\twith\t[10,10,10]' ii. [1,1,1]'\twith\t[2,5,1]' 1 3 4 5 iii. = with = 9 10 10 2 2.\t[30\tpts]\tPlotting\tin\tMATLAB. a) Consider\tthe\tfollowing\tfunction: = = sin + ! + 6! Create\tvectors\tfrom\t-10\tto\t10\twith\tthe\tfollowing\tstep-sizes: i. 5 ii. 1 iii. 0.1 iv. 0.001 v. 0.00001 plot\tthe\tresults\ton\tthe\tsame\tgraph. Add\taxis\tlabels,\ttitle\tand\tlegend. b) Create\tmultiple\tfigures,\tplotting\tall\tdata\tfrom\tpart\t(a). Create\tnew\ttitles,\tas necessary. Change\tthe\tline\tstyles\tto\tthe\tfollowing: i. red,\tblack,\tgreen,\tcyan,\tmagenta\t-\tgrid\ton ii. black\tdiamonds,\tred\tcircles,\tblue\tx's,\tdashed\tmagenta,\tdotted\tgreen\t-\tgrid\toff iii. black\tasterisks,\tred\tsquares, dotted\tred,\tblue\tdashes,\tmagenta\tsquares\t-\tgrid on MAE\t215:\tIntroduction\tto\tProgramming\tin\tMATLAB Summer\tB\t2016 Homework\tAssignment\t#3 Due:\tTuesday,\tJuly\t19th\tby\t11.59\tpm c) Consider\tthe\tfollowing\tfunctions: ! = 6sin ! + cos 2! ! = 12sin 2! + cos 4! define\tx1\tfrom\t0\tto\t2\twith\tthe\tfollowing\tnumber\tof\telements: i. 10\telements ii. 100\telements iii. 1000\telements iv. 10000\telements for\teach\t(i)\t-\t(iv)\tabove,\tevaluate\ty1\tand\ty2. Create\ta\tsingle\tfigure\twindow\tshowing the\tprogression\tof\tresolution\tas\telements\tare\tadded\tto\tx1. Each\tplot\tshould\thave\ta legend,\tappropriate\ttitle\tand\taxis\tlabel\tand\tinclude\tthe\tresults\tfrom\tboth\ty1\tand\ty2. (hint:\tuse\tsubplots). d) Consider\tthe\tfollowing\ttwo\tfunctions: ! = 3 ! + 3 + 87 ! = + 3 + 64 2 evaluate\tthese\tfunctions\tfrom\tx\t=\t0\tto\t100\tin\ta\tstep\tsize\tthat\tgives\tacceptable resolution\t(use\tyour\tjudgment!). Plot\tthe\tresults\ton\tthe\tsame\tfigure. What\tis\tone problem\twith\tthe\tfigure\tgenerated? Find\tanother\tMATLAB\tfunction\tthat\twill\tfix\tthis plotting\tissue\tand\tregenerate\tyour\tplot. Add\tappropriate\taxis\tlabels,\tlegends,\ttitles, etc. e) Consider\tthe\tdata\tset\tgiven\tby\tthe\tx\tand\ty\tvectors\tbelow: y\t=\t[\t3,\t15,\t26,\t35,\t41,\t52,\t60,\t77,\t84,\t90,\t95,\t100] x\t= [\t5,\t10,\t15,\t20,\t25,\t30,\t35,\t40,\t45,\t50,\t55,\t60] Plot\tthis\tdata\tusing\ta\tsemi-log\tscale,\tcreating\ta\tplot\tthat\thas\ta\tnatural\tlogararithmic y-axis. (hint:\tsemilogy()). 3.\t[40\tpts]\tWorking\twith\tMATLAB\tfunction\tfiles. a) Write a function file, that accepts values of x as inputs and outputs the value of y when\tthe\tinput\tis\tpassed\tthrough\tthe\tfollowing\tfunction: = !"!!!.!" + 4 + 0.2 ! evaluate\tthe\tfunction\tat a\trange\tof\tx\tvalues\tfrom\t0\tto\t1\twith\t143\telements. b) Consider the functions below, both of which are dependent on a single input, x. Create\ta\tfunction\tfile\tthat\twill\treturn\tthe\tvalue\tof\tboth\tcalculations\twhen\tprovided\ta value\t(or\tseries\tof\tvalues)\tof\tx. Evaluate\tyour\tfunctions\tfor\tx\tvalues\tof\t1,2,3\tand\t4\tas well\tas\tthe\tvector\tfrom\t0\tto\t10\twith\t1000\telements. Plot\tyour\tresults,\tadding\tfigure labeling, legends, etc. as necessary. You should present two plots, each with two lines. ! = + 5 ! = !! + sin () c) d) e) f) g) MAE\t215:\tIntroduction\tto\tProgramming\tin\tMATLAB Summer\tB\t2016 Homework\tAssignment\t#3 Due:\tTuesday,\tJuly\t19th\tby\t11.59\tpm Modify\tyour\tfunction\tfrom\t3(b)\tso\tthat,\tafter\tevaluating\tthe\tvalue\tof\ty1\tfor\ta\tgiven value\tof\tx,\tan\tintermediate\tcalculation\tis\tperformed\twhich\tdivides\tx\tby\t10\tbefore\tit is\tused\tin\tevaluating\ty2. Evaluate\tyour\tfunction\tat\tthe\tsame\tpoints\tas\t3(b)\tand compare\tthe\tresults. Create\ta\tfunction\tfile\tto\tevaluate\tthe\tvalue\tof\tsin accurate\tto\t9\tTaylor\tseries\tterms. Recall,\tthe\tTaylor\tseries\tfor\tsin is\tgiven\tby: ! ! ! ! !! !" !" !" sin + + + + 3! 5! 7! 9! 11! 13! 15! 17! *\tNOTE:\tThere\tare\tmultiple\tways\tto\tdo\tthis\tproblem. Think\tit\tthrough\tbefore\tyou code! Evaluate\tyour\tfunction\tat\tvarious\tpoints\ton\tthe\tdomain\t[0, 2].\t(at\tleast\t3) Create\ta\tfunction\tfile\tto\tevaluate\tthe\tmultivariable\tfunction\tf(x,y,z)\tbelow. ! , , = ! + ! + ! evaluate\tthe\tfunction\tat\tthe\tfollowing\tpoints:\t(1,1,1),\t(1,0,1),\t(e3,1,5). Consider\tan\tobject,\twhose\tposition\talong\tthe\tx-axis\tis\tgiven\tby: 1 = ! 2 create\ta\tfunction\tthat\thas\ttime\tas\tan\tinput\tand\treturns\tthe\tposition\t(along\tx)\tof\tthe object,\tthe\tx-axis\tvelocity\tat\ttime\t\"t\"\tand\tthe\tacceleration\tof\tthe\tobject.\t(hint:\tthink about\thow\tmany\toutputs\tthe\tfunction\tmust\thave\tand\thow\tto\trelate\tthe\tvelocity\tand acceleration\tto\tthe\tgiven\tfunction). Plot\tthe\tabove\tquantities\tfrom\tt\t=\t0\tto\t10\twith 100\telements. You\tshould\tuse\tsubplot\twhere,\tfrom\ttop\tto\tbottom\tthe\tplots\tshould be\tin\tthe\torder:\tposition,\tvelocity,\tacceleration. All\tplots\tshould\tbe\tlabeled appropriately. Create\tanonymous\tfunctions\tin\tyour\tscript\tfile\tto\tdefine\tand\tevaluate\tthe\tfollowing functions: i. = ! + 4 + 6 for\tx\t=\t1,5,10 ii. , = + ! ! ( 1)\tfor\t(1,4),\t(-1,-4),\t(4,1) iii. iv. ! ! , = sin + cos 2 for\t(0,0),\t( ! , ! ) , = !" + ln 4 log!" 5 for\t(1,1),\t(6,4),\t(2,10)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial Algebra advanced algebra with financial applications

Authors: Robert K. Gerver

1st edition

978-1285444857, 128544485X, 978-0357229101, 035722910X, 978-0538449670

More Books

Students also viewed these Mathematics questions