How to Use Numerical Integration
Mostrar comentarios más antiguos
How do you do numerical integration for the velocity when given the time and acceleration? I also know that this data is first recorded when the rocket has a velocity, vi, of -250 m/s and that the integral of acceleration is velocity. Using numerical integration, I need to calculate the velocity as a function of time. the data is taken every .001 seconds. below is what I have coded so far and attached is the data excel sheet.
%% Data
data = xlsread('Rocket.xls');
t = data(:,1);
a = data(:,2);
%% Rockets Velocity??
Respuestas (1)
Star Strider
el 25 de Mayo de 2016
If your data are vectors, use the cumtrapz or trapz function, depending on what result you want.
For example:
v = cumtrapz(t, a); % Calculate Velocity
d = cumtrapz(t, v); % Calculate Displacement
2 comentarios
Victoria Lucero
el 25 de Mayo de 2016
Star Strider
el 25 de Mayo de 2016
I don’t have your data, so I assumed they were the same lengths.
You would first have to shorten the longer vector, and since I don’t know which one that is, I have to generalise.
Do this first:
L = min(length(t),length(a));
a = a(1:L);
t = t(1:L);
then do the integrations.
Categorías
Más información sobre Numerical Integration and Differentiation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!