How to Use Numerical Integration
古いコメントを表示
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??
回答 (1 件)
Star Strider
2016 年 5 月 25 日
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 件のコメント
Victoria Lucero
2016 年 5 月 25 日
Star Strider
2016 年 5 月 25 日
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.
カテゴリ
ヘルプ センター および File Exchange で Numerical Integration and Differentiation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!