Matlab m files download slopefield






















Select the China site in Chinese or English for best site performance. Other MathWorks country sites are not optimized for visits from your location. Toggle Main Navigation. Search MathWorks. Close Mobile Search. Trial software. You are now following this Submission You will see updates in your followed content feed You may receive emails, depending on your communication preferences. Simple Slopefield version 2. View Version History. Notice that in this problem, our dependent variables are named x and y rather than y 1 and y 2.

That's okay! The names of the variables don't actually matter. Like the function g in Example 2. This time, Y 1 will stand for x , since that's our first dependent variable; Y 2 will be y. These are parametric equations of a straight line. Use the techniques we've learned involving phaseplane to plot a phase portrait of 11 , where the x and y values are between -5 and 5. Then, on the same plot, use drawphase to draw at least three different solution curves.

Include the resulting plot in your Word document. Describe in your Word document how this changes the phase portrait. This problem is again fairly easy to solve by hand.

Whenever we first try out a program, it's a good idea to try some problems for which you already know the answer; that way you can check that the program behaves the way you expect. Now we have a separable ODE:. What kind of curve is this? Use phaseplane to plot a phase portrait of 12 , where the x and y values are between and Include your figure in your Word document.

Then use phaseplane to draw a phase portrait for the system 13 , and plot a phase path on your diagram using drawphase ; the y1start value represents x 0 and should therefore be zero, while the y2start value can be any initial value for y 0 of your choosing. Finally, try adding a few more phase paths using other values for y 0. Paste the resulting figure into your Word document.

What's the relationship between your phase portrait figures and your direction field figure? Try drawing some phase paths on your phase portrait with the same initial values.

Do the resulting curves match up? We'll now consider a mathematical model of population dynamics: a predator and prey system. Suppose that two species of animals, say, foxes and rabbits, coexist on an island. The foxes eat rabbits, and the rabbits eat vegetation, which we'll say is available in unlimited amounts. The following system of ODEs, which is called the Lotka—Volterra model, can be used to model this situation.

Here, x is the population of rabbits, y is the population of foxes, and a , b , c , and d are positive constants. We will now use phaseplane and drawphase to investigate the solutions to this system. In this lab, we have seen that plots of direction fields and vector fields can be useful when trying to understand the behavior of solutions of ordinary differential equations.

This is particularly important when we cannot solve the equation analytically. It is important to understand that these techniques do not in any obvious way scale to systems of hundreds of equations. Assignment 4 will present techniques which are effective for large linear systems and as such are a mainstay of modern technology and science. Hopefully, many of you are curious. How are those solution trajectories we just saw produced?

Behind the scenes, the M-Files we used in this lab work by approximately solving ODEs via numerical approximation. You can actually open the M-Files and read them yourself, if you want to see what they're doing. These numerical methods will be the topic of Assignment 3. They typically work well for large systems.

You do not need to include this sketch in your write-up. Now solve the differential equation given in part a , either working it out by hand or using the dsolve command that we saw in Assignment 1. Compare your answers to parts a and b.

Plot a direction field for 5 for x and y between -5 and 5. Paste your plot into your Word document. Recall that an initial value problem consists of a differential equation along with an initial condition. Write out the initial value problem that we must solve here.

We already have the differential equation, so this means you need to find the appropriate initial condition. To simulate the conditions in the fridge, we must pick the parameter A.

What do you think the value of A should be? How long does it take to defrost a chicken breast under the above conditions? A rough estimate from a direction field plot is sufficient. The syntax for drawphase is as follows: drawphase g, tmax, y1start, y2start In this command, g is the same function g t,Y we defined earlier.

Set the minimum values of x and y to -1 and the maximum values to Where in the x-y plane are the physically possible solutions? Remember, x and y represent populations. Can they become negative?

You can run a script by typing its name at the command line. To create scripts files, you need to use a text editor.

If you are using the command prompt, type edit in the command prompt. This will open the editor. You can directly type edit and then the filename with. If you want to store all program files in a specific folder, then you will have to provide the entire path. Let us create a folder named progs.



0コメント

  • 1000 / 1000