MATLAB What is Causing an Error in My Matlab Code for Solving a System of Equations?

  • Thread starter Thread starter dexter90
  • Start date Start date
  • Tags Tags
    Matlab System
AI Thread Summary
The discussion centers around a MATLAB function named "kkd" that defines a system of differential equations. The user encounters an error when trying to solve these equations using the ode45 function. The primary issue identified is the lack of initial conditions for the variables x and y, which are referenced as y(1) and y(2) in the function. The solution to the error is to properly set the initial conditions when calling ode45, ensuring that the function can execute without issues.
dexter90
Messages
14
Reaction score
0
I have function:

Code:
function dxdy = kkd(t,y)
x=y(1);
y=y(2);
dxdy(1)=-0.02*x+x*x*y+0.01;
dxdy(2)=0.02*x-x*x*y;

next

[t,y]=ode45(@kkd,[0 4],[0 10]);

but is error... Where is error??
 
Physics news on Phys.org
you never set the initial conditions, what is y(1) and y(2)?
 
It is ok, work.

I greet.
 

Similar threads

Replies
4
Views
1K
Replies
5
Views
2K
Replies
2
Views
3K
Replies
8
Views
2K
Replies
1
Views
2K
Replies
2
Views
3K
Back
Top