Re: Simulate System- Matlab

Quote:

Originally Posted by

**Len** I'm using mathworks(

Solve initial value problems for ordinary differential equations - MATLAB) to help me, I need to simulate a system, in particular this one.

http://img849.imageshack.us/img849/4426/math3090q1.jpg
From Example 1 on mathworks, I'm trying to convert it for my needs

function dy = Question1(t,y)

dy = zeros(3,1); % a column vector

dy(1) = 1.1 * y(1) * (1 - y(1)) - y(2) * (y(1) / (1 + y(1)));

dy(2) = y(2) * (5*(y(1) / (1+(y1)))-0.2)-y(3)*(y(2) / (1+y(2)));

dy(3) = y(3)*(0.006 * (y(2) / (1+y(2)))-0.001);

Saving file as Question1.m

[T,Y] = ode45(@Question1,[0 10],[1 1.3 3.3]);

plot(T,Y)

but I'm getting error

??? Input argument "y" is undefined.

Error in ==> Question1 at 3

dy(1) = 1.1 * y(1) * (1 - y(1)) - y(2) * (y(1) / (1 + y(1)));

You have a typographical error in the line dy(2)=...

CB