Question: MATH 282 MATLAB Assignment 1 Instructions: Complete each problem using MATLAB to help you. You may need to do part of a problem by hand
MATH 282
MATLAB Assignment 1
Instructions: Complete each problem using MATLAB to help you. You may need to do part of a problem by hand and part using MATLAB. Any additional instructions for a problem will be listed below it.
Hand In: Unless otherwise specified below, you should hand in your work for each problem including: Any parts of the problem you have done by hand. (These parts should still be typed!)
Any MATLAB commands/results that you used to help you solve the problem (you can copy and paste commands/results in MATLAB from the command prompt into a Word document). Please delete any MATLAB errors (reported in red by MATLAB) from your commands/results in the Word document. Any MATLAB plots created in the problem. (You can also copy and paste MATLAB plots into a Word document.)
Follow the instructions on the MATLAB Assignment 1 Guidelines document!
We are given that is an explicit solution of the first-order differential equation
Using MATLAB, plot the function over . Add a title and axis labels to your plot.
Find an interval I of definition for this solution. (Hint: I is NOT the interval .)
Explain why I is not the interval .
In class we found that is the general solution to the DE .
Use MATLAB to plot the solutions corresponding to over
. Plot all of these on the same plot. You can do this in MATLAB by
typing in the command
>> hold on
before you type in your plot commands. You only need to type this command once. After you type it, all plots that you make will appear on the same figure.
Also, change the window of your plot in the y direction to be from -10 to 10. You can do this in MATLAB by typing in the command
>> axis([-10,10,-10,10])
after you type in your plot commands. Add a title and axis labels to your plot.
b) As what happens to the solutions? Why do you expect this to happen?
In this problem we will investigate what happens to the solution of an IVP when we make a very small change to either the initial condition or the differential equation.
Use the dsolve command in MATLAB to find an explicit solution to
.
Using MATLAB, plot your solution from part a) over .
Lets see what happens when we make a very small change to the initial condition.
Use the dsolve command in MATLAB to find an explicit solution to
.
Using MATLAB, plot your solution from part c) over .
Now, lets see what happens when we make a very small change to the differential equation.
Use the dsolve command in MATLAB to find an explicit solution to
.
Using MATLAB, plot your solution from part e) over and .
(You can change the window in the y direction using the axis command the same command you used in problem 2) above.)
Compare the solutions to the three IVPs using the plots that you created in MATLAB in parts b), d), and f) by answering the following questions.
Are the solutions relatively similar or are they totally different? If they are different, how are they different? Given that all three IVPs were very similar, would you expect this behavior in the solutions?
Now use MATLAB to plot all three of your solutions (found in parts a), c), and e)) on the same plot and each over and . Add a descriptive title to your plot.
You can plot all three of these solutions on the same figure in MATLAB by typing in the command
>> hold on
before you type in your plot commands. You only need to type this command once. After you type it, all plots that you make will appear on the same figure.
i) Since we are looking at IVPs, we can narrow our focus to what each solution looks like around its initial condition. Now compare the three solutions in the plot you created in part h) by answering the following questions. (Note the scale on your graph from part h).)
Are the solutions relatively similar in this region near the initial conditions or are they totally different in this region near the initial conditions? Given that all three IVPs were very similar, would you expect this behavior in the solutions?
A simple model for the shape of a tsunami, or tidal wave, is given by
where is the height of the wave expressed as a function of its position relative to a point off-shore.
By inspection (and thus by hand), find a singular solution of the IVP.
Use the dsolve command in MATLAB to find an explicit, nonconstant solution of the IVP. (This command will also give you the solution you found in part a).)
Note that the expression tanh(x)^2 in MATLAB means , where is the hyperbolic tangent function.
Using MATLAB, plot your solution from part b) over . (Your plot should look like a wave!)
The following MATLAB code performs Eulers method for an IVP.
Note: MATLAB starts indexing with 1 and not 0! When we do Eulers method by hand, we call our initial values and . MATLAB calls its initial values and . So, for example, if by hand we calculated , , , using Eulers method, MATLAB would calculate the same six points but they would be labeled , , , .
Answer each of the following questions by hand.
What IVP is being used in this code? (You need to give the DE and the initial condition. Write the IVP in the way that IVPs are written in our textbook, ie. not using MATLAB notation.)
What is the final value for (ie. what is )?
Suppose you want to change the step size to 0.2 but still end at the same final value for as in this code example. What two lines would you need to change and how would
you change each one to accomplish this? (Just give the line numbers and the two new lines that you would use.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
