Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The general solution to the differential equation dy dx = 3 x 1 x 2 + 8 cos ( x ) is y ( x

The general solution to the differential equation dy
dx =3x 1x2+8 cos(x) is
y(x)=3
2 x21
3 x3+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 <=9, with initial conditions y(0)=20,40,60.
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,9]
y1= f (??) ; % compute the solution with C =20
y2= f (??) ; % compute the solution with C =40
y3= f (??) ; % compute the solution with C =60
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 =3x 1x2+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

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions