• Support PF! Buy your school textbooks, materials and every day products Here!

Matlab- expressing derivatives in an equation with ode45?

  • Thread starter Dsab123
  • Start date
  • #1
2
0

Homework Statement



(-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

Homework Equations



---

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!

Homework Statement





Homework Equations





The Attempt at a Solution

 

Answers and Replies

  • #2
34
0
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.
 

Related Threads on Matlab- expressing derivatives in an equation with ode45?

  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
5
Views
2K
  • Last Post
Replies
1
Views
8K
  • Last Post
Replies
2
Views
2K
Replies
1
Views
878
Replies
6
Views
3K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
2
Views
3K
Replies
5
Views
941
Top