1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Matlab, plotting a directional field

  1. Oct 2, 2015 #1
    1. The problem statement, all variables and given/known data

    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.

    2. Relevant equations

    3. 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.

  2. jcsd
  3. Oct 2, 2015 #2
    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?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted