I'm looking for way to solve this differential equations.
I've got small experience solving this type of equations, so here's my noob code
function lab1()
[t,h]=ode45('threepoint', [0 1000], [0 0.25]);
plot(t, h);
function f = threepoint(x, y)
%THREEPOINT Summary of this function goes here
% Detailed explanation goes here
m = 15000;
R1 = 0.1;
R2 = 0.1;
P1 = 0.1;
P2 = 0.1;
B = 4;
rbk = 0.5;
f=[x(6);
x(7);
x(8);
x(9);
x(10);
(-x(6) / (m * sqrt( x(6)*x(6) + x(7)*x(7)))) * (R1 + R2) + (cos(x(3))/m) * P1 + (cos(x(3))/m) * P2;
(-x(7) / (m * sqrt( x(6)*x(6) + x(7)*x(7)))) * (R1 + R2) + (cos(x(3))/m) * P1 + (cos(x(3))/m) * P2;
-(M/I) - (1/I1)* (B/2 + y(1))*P1 + (1/I2)*(B/2+y(2))*P2;
(rbk/I1)*(P1-R1);
(rbk/I2)*(P2-R2);
];
end
While running these functions I have got such errors like
Index exceeds matrix dimensions.
Error in threepoint (line 11) f=[x(6);
Error in odearguments (line 87) f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 113) [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in lab1 (line 2) [t,h]=ode45('threepoint', [0 1000], [0 0.25]);
Can anyone please show me where am I mistaken and how can I fix these errors? Thank you in advance!
[TOUT,YOUT] = ode45(ODEFUN,TSPAN,Y0)
. Now look at your error. The time span has to be a vector, rather than 2 separate start/end values. – Andras Deak