1. PF Contest - Win "Conquering the Physics GRE" book! Click Here to Enter
    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!

Graphing a differential equation in mathematica?

  1. Apr 7, 2009 #1
    1. The problem statement, all variables and given/known data

    I'm trying to graph a first order differential equation in Mathematica but the graph doesn't seem right when compared to my txt book. I'm using NDSolve.

    The first order diff-eq is...

    dy/dt' = -cy-sin(x)+fcos(z)

    where z = omega t'

    c = 0.05
    f = 0.4
    omega = 0.7

    Time t' is the x-axis
    and dx/dt' is the y-axis

    3. The attempt at a solution

    I have...

    s = NDSolve[{\[Omega] x'[z] ==
    y[z], \[Omega] y'[z] == -c y[z] - Sin[x[z]] + f Cos[z],
    y[0] == -1, x[0] == 0}, {x, y}, {z, 0, 30}]

    Plot[Evaluate[y[z] /. s], {z, 0, 30}, PlotRange -> All]

    the graph should look akin to a cos function but the peaks are off compared to what's in my txt book.

    Any ideas?
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted