Salut à tous,
je m'arrache de nouveau les cheveux devant mon ordinateur : j'essaye de modéliser le vol d'un volant de badminton par équation différentielle le haut du code m'a été donné par mon prof en me disant vous ne devez pas le comprendre changez juste le dernier paragraphe...
Ok ca fait plaisir voila le résultat :
clear;
mov = avifile('c:\test113.avi','Comp ression','None','Quality',100, 'fps',25)
global g rho m SCx
g = 9.81;m = 0.005;rho = 1.183;SCx = 0.001431147
figure('NumberTitle','off','Na me','Qu y mettre ???')
axis([-6 20 -6 6]);hold on;
xlabel('X + unité');
ylabel('Z +unité');
for i=1:100
options = odeset('RelTol',1e-5);
[t,y] = ode45('Project',[0:0.05:20],[i/5 0],options);
plot(y(:,1),y(:,2));
F = getframe(gcf);
mov = addframe(mov,F);
zoom on;
hold on;
end
mov = close(mov);
% et la suite dans un .m
function dy = Project(t,y)
global g rho m SCx
theta = atan(y(4)/y(2));
dy = zeros(4,1);
dy(1) = y(2);
dy(2)=-cos(theta)*(y(2)^2)*0.5*rho*SC x/m;% betement les force de trainée
dy(3)=y(4);
dy(4)=-g-sin(theta)*(y(4)^2)*0.5*rho*SC x/m;%betement les forces de trainée
Voila la réponse de matlab c'est comlètement incompréhensible à mes yeux :
??? Attempted to access y(4); index out of bounds because numel(y)=2.
Error in ==> Project at 9
theta = atan(y(4)/y(2))
Error in ==> funfun/private/odearguments at 110
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ==> ode45 at 173
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in ==> untitled10 at 24
[t,y] = ode45('Project',[0:0.05:20],[i/5 0],options);
Je sais que je vous en demande beaucoup mais vous êtes mon dernier recours !!!
Fiz
![]()



