Question: The general solution to the differential equation dy dx = 7 x + 1 1 x 2 + 1 2 cos ( x ) is
The general solution to the differential equation dy
dx x x
cosx is
yx
x
x
sinx C with y C
The goal of this exercise is to write a script file to plot the solutions to the differential equation
in the interval x with initial conditions y
The script file should have the structure scriptfunction similarly to the Mfile myplotm
Example Call the file exm The function that defines yx must be included in the same file
note that the function defining yx will have two input arguments: x and C
Your Mfile should have the following structure fill in all the with the appropriate commands:
x ; define the vector x in the interval
y f ; compute the solution with C
y f ; compute the solution with C
y f ; compute the solution with C
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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
