Hi,
I am trying to solve a 2 equations system of ODE where the first function is a 2×1 vector and the second a scalar. I tried a simple example but I get an error such as: "in an assignment A(I)=B, the number of elements in B and I must be the same"
also before I got an error claiming that the outcome of @rigid is a 2×1 and my input as initial conditions is a 3×1 and thus is wrong. So this means that matlab is not recognizing that my outcome y should be a 3×1. I dont know how to fix this.
My code is:
function dy = rigid(t,y);
rho1=zeros(2,1)) rho1(1,1)=0.5; rho1(2,1)=2; rho0=1; mu1=zeros(2,2); mu1(1,1)=2.2; mu1(1,2)=1.2; mu1(2,1)=0.4; mu1(2,2)=2; mu0=zeros(2,1); mu0(1,1)=1.2; mu0(2,1)=3.2;
dy=zeros(3,1);
dy(1)=rho1-mu1*y(1:2); dy(2)=rho0-mu0'*y(1:2);
[t,y] = ode45(@rigid,[0 12],[0 0 0]);
Any help with this?
thanks in advance.
Best Answer