1. Not finding help here? Sign up for a free 30min 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!

Matlab- expressing derivatives in an equation with ode45?

  1. Sep 19, 2010 #1
    1. The problem statement, all variables and given/known data

    (-1)^4*xdx + (8y-y^2-13)dy=0; y(0)=4;
    1. Use dsolve to obtain a solution.
    2. As dsolve was not much help fi nd an implicit solution of the form
    f(x, y) = 4

    2. Relevant equations

    ---

    3. The attempt at a solution

    the dsolve part was easy, i just did:

    syms x y t
    dsolve('(-1^4)*x*Dx+(8*y-y^3-13)*Dy=0', 'y(0)=4')
    and got a huge matrix-type answer.

    So now, i'm having some trouble with 2. My prof told us to use ode45, and this is what i'm thinking:

    Z='(-1^4)*x*Dx+(8*y-y^3-13)*Dy=0'
    [x,y]=ode45(Z, -10:10, 4)

    but i'm getting some errors that its not a proper function name, and some stuff with feval.
    Is the problem with the Dy and Dx? My prof suggested using inline, but i read that its older syntax that doesn't really help much, according to mathworks :/

    Any suggestions? thanks!
    1. The problem statement, all variables and given/known data



    2. Relevant equations



    3. The attempt at a solution
     
  2. jcsd
  3. Sep 20, 2010 #2
    ode45 (and all the other FD solvers in matlab) need you to provide it with a function that evaluates the differential equation at a given point. For example, check out function handles.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Matlab- expressing derivatives in an equation with ode45?
  1. Matlab: ode45 help (Replies: 1)

  2. Matlab ode45 Problem (Replies: 5)

Loading...