How do you plot nonhomogeous equations in Mathematica?

  • Topic: Mathematica 
  • Thread starter yitriana
  • Start date
  • Tags Tags
    Mathematica Plot
1 reply · 2K views · last reply
yitriana
Messages
35
Reaction score
0
NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30}]

i attempted this, but it didn't work.
 
Try this:

Code:
sol1 = NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30}];
Plot[y[x] /. sol1, {x, 0, 30}]