Matlab, plotting a directional field

Click For Summary
SUMMARY

The discussion centers on plotting a directional field for the differential equation y' = −t(y² − 0.5y − 0.5) using MATLAB. The user seeks guidance on utilizing the line function and the dfield extension to achieve this. Key points include the requirement to plot lines every 0.25 units in t and y, with each line having a length of 0.1. The user expresses confusion regarding the correct syntax for the dfield8 function and how to input the equation and coordinates properly.

PREREQUISITES
  • Basic understanding of MATLAB programming
  • Familiarity with differential equations
  • Knowledge of MATLAB's line function syntax
  • Experience with MATLAB extensions, specifically dfield
NEXT STEPS
  • Research the syntax and usage of the dfield8 function in MATLAB
  • Learn how to define and manipulate directional fields in MATLAB
  • Explore MATLAB's line function to understand coordinate plotting
  • Investigate examples of plotting differential equations in MATLAB
USEFUL FOR

Students in MATLAB courses, beginners in programming, and anyone interested in visualizing differential equations through directional fields.

javaistheman
Messages
8
Reaction score
0

Homework Statement



Plot the direction field of y' = −t(y 2 − .5y − .5) for t=[0,5] and y=[-2,2]. Plot a line every 0.25 units in t and y. The length of each line should be 0.1. Hint: Use line(). Look at the picture to determine the starting and ending coordinates of each line.

Homework Equations

The Attempt at a Solution



So I'm a big time beginner in anything related to programming. I'm in a MATLAB class right now with no prior experience at all, and the resources given don't talk about directional fields at all.

I know the line function goes in the format line(X,Y) with X and Y being the coordinates (0, 1 as default). The problem statement says to use this but I'm not sure how to use it to define the length and spacing.

I know there's a plot function also, where you can plug in certain defined lines to make the plot. Once again, I don't know how that ties into a directional field.

I know this website doesn't like when somebody is clueless and not on the verge of figuring the problem out, but all I ask is for some guidance on what the functions are that I'll be using for this. Is there a specific directional field function to use or is it a combination of multiple line functions? Any help would be greatly appreciated.

engr231_zpsok907aep.png
 
Physics news on Phys.org
Update: I just discovered the Matlab extension "dfield." I added the function into matlab, ran it, added it to the current path. I still don't know the format of entry though. For example, I typed dfield8(y'=-t(y^2-0.5y-0.5)) and it obviously gave an error. Where does the equation get plugged in? And the coordinates?
 

Similar threads

  • · Replies 10 ·
Replies
10
Views
2K
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
1
Views
2K
Replies
1
Views
6K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K