Answered step by step
Verified Expert Solution
Question
1 Approved Answer
HW7P1 (30 points) It is required to plot each of the following 2 functions and its first and second derivatives. All will be plotted versus
HW7P1 (30 points) It is required to plot each of the following 2 functions and its first and second derivatives. All will be plotted versus the independent variable x or t. Every function and its derivatives will be plotted in just one figure, i.e., one figure window for each. f,,(x)-n e-nx(n2xt-8nx3 +12x2) for-3 x 0 in (figure 1), n :0.4. 2. y(t) 10k cos(t) e-kt, y'(t) --10keKt[k cos(t) +sin(t)] y"(t) 10ke-kt[k2 cos(t) + 2k sin(t) - cos (t)], for-8sts8 in (figure 2), k- 0.2 a) Write a script file (HW7P1a.m) to plot each of the 2 functions using the plot function: f(x), f'(x) and f"(x) in figure(1) and y(t), y'(t) and y"(t) in figure(2). The script must do the following i (2 pts) Create the variables x and t according to their ranges using the Hnspace function with 100 points (6 pts) Determine f, fd, fddandy, yd, ydd Use elementwise operation (2 pts) Use single plot command to plot the function and both derivatives in one plot in the designated figure window. (2 pts) Plot the functions f(x) and y(t) with a solid blue line, f'(x) and y'(t) with a dashed red line and f"(x) and y"(t) with a green dash-dot line. Use a line width of 1 for all lines (2 pts) Add grid, legend, title and label the axes of each figure iii. iv. v. b) Write another script (HW7P1b.m) to redevelop the same plots of part a using multiple fplot function with hold on/off instead of single plot function. You must notice that you do not need to create x, f, fd, fddort, y, yd, ydd as before Redo part (b) in a new script (HW7P1c.m) using the fplot, but instead of plotting multiple lines in one figure use one subplot for each of f(x), f'(x) and f"(x) and the same for y(t),y'(t) and y"(t). Use subplot (3,1,...) . Do not add legend for the subplots but add labels, grids and titles. Name your script. c) You must note that parts (a) and (b) develop mostly the same figures while part c is different. In your hard copy show the plots developed by parts B and C only. Submit your script files and a copy of your figures
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started