Exercise 5 The general solution to the differential equation dy dx = −17x − 2x 2 − 8 cos(x) is y(x) = − 17 2 x 2 − 2 3 x

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899559
Joined: Mon Aug 02, 2021 8:13 am

Exercise 5 The general solution to the differential equation dy dx = −17x − 2x 2 − 8 cos(x) is y(x) = − 17 2 x 2 − 2 3 x

Post by answerhappygod »

Exercise 5 The general solution to the differential equation dy
dx = −17x − 2x 2 − 8 cos(x) is y(x) = − 17 2 x 2 − 2 3 x 3 − 8
sin(x) + C with y(0) = C. The goal of this exercise is to write a
script file to plot the solutions to the differential equation in
the interval 0 ≤ x ≤ 5, with initial conditions y(0) = 60, 100,
140. The script file should have the structure script+function
(similarly to the M-file myplot2.m Example 2). Call the file ex5.m.
The function that defines y(x) must be included in the same file
(note that the function defining y(x) will have two input
arguments: x and C). Your M-file should have the following
structure (fill in all the ?? with the appropriate commands): x =
?? ; % define the vector x in the interval [0 ,5] y1 = f (??) ; %
compute the solution with C = 60 y2 = f (??) ; % compute the
solution with C = 100 y3 = f (??) ; % compute the solution with C =
140 plot (??) % plot the three solutions with different line -
styles title (??) % add a title legend (??) % add a legend function
y = f (x , C ) y = ?? % fill -in with the expression for the
general solution end Plot the graphs in the same window and use
different color and/or line-styles for each graph. To plot the
graphs in the same window you can use the command hold on or use
the plot command similarly to Exercise 4. Add the title ’Solutions
to dy/dx = −17x − 2x 2 − 8 cos(x)’. Add a legend with the list of C
values used for each graph. (Type help plot for a list of the
different line-styles, and help legend for help on how to add a
legend.) Include both the M-file and the plot in your report. NOTE:
the only output of the script file should be the graph of the three
curves. Make sure you use enough points so that the curves are nice
and smooth.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply