salut
dans le cadre des maths on travail sur le logiciel octave (matlab)
voila mon probléme je n'arrive pas a faire les tp en entier , je bloque totalement sur certaine question
il faut avouer que l'informatique et loin d'etre mon dada
est ce que quelqu'un pourrait m'aider
4. Modifier le programme energy.m pour qu'il utilise la méthode d'Euler à la place de celle
d'Euler-Cromer. Refaire la question 1 avec ce nouveau programme et comparer les résultats
avec la méthode d'Euler-Cromer. Conclusion.
5. Modifier le programme energy.m pour qu'il présente la vitesse et la position en fonction du
temps. Exécuter votre programme pour les valeurs de la question 1.
6. Ecrire un programme qui permet de calculer la période d'oscillation de la particule. Représenter
graphiquement cette période pour les valeurs initiales de la question 1. Utiliser un graphique
semi-logarithmique.
voici les questions qui me bloque , la 6 j'ai fait quelque chose mais c'est a verifier
voici leprogramme energy.m
% This matlab program computes the kinetic and potential energies
% of a particle under the action of a conservative force
clear all;
clf;
% Initialisation of alpha and beta
alpha =1.0;
beta=0.1;
% Input the initial position
x=input('Enter the initial value of the displacement in meters:');
% set up the initial velocity, mass and time step
v=0; % Initial velocity in meters/s.
mass = 1.0 % Mass of particle
step = 0.02 %time step in seconds
Kenergy(1) =0.5 * mass * v^2; % kinitic energy
Uenergy(1) = -0.5 *alpha * x^2 + beta * x^4; % potential energy
Tenergy(1) = Kenergy(1) + Uenergy(1); % total energy
Nstep = 601
% start the calculation
% start preparing the graphics
xlabel('Time (s)'); % x-axis label
ylabel('Enrgy (J)'); % y-axis label
title('Kinitic energy (-) and potential energy (+) and total (*)')
hold on;
for istep = 1: Nstep % make the number of steps necessary
Kenergy (istep) =0.5 * mass * v^2; % kinitic energy
Uenergy (istep)= -0.5 *alpha * x^2 + beta * x^4; % potential energy
t (istep) = (istep -1) * step; % time
Force = alpha * x - 4 * beta * x^3; % compute the force on the particle
accel = Force / mass; % compute the accel. on the particle
% compute the velocity and position using Euler-Cromer algo.
v = v + accel * step; x = x + v * step;
endfor
Energylimit1 =max(Kenergy) + 0.1
Energylimit2 =min(Uenergy) - 0.1
%Energylimit =int32 (Energylimit+0.5)
axis([0, Nstep * step, Energylimit2(1), Energylimit1(1)]); % Set axis limits
plot(t,Kenergy,'r-'); % plot the Kinetic energy
plot(t,Uenergy,'b+'); % plot the potential energy
merci d'avance pour toute aide