I'm not sure if I'm being thick here, but I'm not used to function handles etc.
I am trying to find the integral of some raw accelerometer data i have, and was advised by a friend that using Simpsons might be the best way. So i found that MATLAB has the "quad()" function but it accepts a function handle as a parameter.
If i have two vectors, one for time, one for acceleration, how can i create them into a function handle to send to quad()?
Thanks
Use one of these two
f = @(x) sin(x);
x = linspace(a,b,200);
y = f(x); % values at f(x)
s1 = trapz(x,y); % you can use trapz
s2 = integral(f,a,b); % you can use integral
Compare the results. Experiment
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.