1. Page 7. Shigeoka MS thesis-capture (store) 3/4 data throttle acceleration data in Matlab
avec
tvec
delta
delta
plot(avec,tvec)
integrate to get vvec
integrate to get xvec
MATLAB CODE
%%
delt= 0.001;
t=[0:0.001:0.8] % 801 points
a=[2.001 2.008 2.016 2.022 2.028 2.035 2.041 2.075 2.086 2.095 2.101 2.109 2.206 2.305 2.404 2.506 3.003 3.012......
3.026 3.036 3.044 3.052 3.061 3.076 3.083 3.099 3.106 3.205 3.320 3.460 3.520 3.620 3.760 3.809 3.999 4.009 4.018 4.065.......
4.098 4.223 4.451 4.852 4.876 4.898 4.903 4.926 4.998 5.003 5.016 5.026 5.046 5.086 5.120 5.223 5.445 5.652 .......
5.785 5.785 5.652 5.543 5.431 5.321 5.211 5.101 5.009 4.456 4.362 4.121 4.002 3.678 3.654 3.541 3.210 3.001 2.987 2.951 ........
2.765 2.542 2.321 2.123 2.002 1.998 1.956 1.845 1.122 1.026 1.001 0.998 0.956 0.945 0.932 0.921 0.910 0.887...
2.1 2.01 2.001 2.2 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.333 2.345 2.366...
2.37 2.38 2.39 2.40 2.44 2.45 2.46 2.47 2.48 2.49 2.6 2.7 2.8 2.9 3.0 3.001 3.002 3.01 3.02 3.003...
2.999 2.98 2.987 2.900 2.80 2.7 2.6 2.5 2.4 2.3 2.2 0 0.9 0.8 0.7 0.8 -1 -1.1 -1.111 -1.2...
-1.22 -1.23 -1.24 -1.25 -1 .9 -.8 .7 .5 .4 .3 .2 0 0 0.1 0.2 0.3 0.444 0.45 0.46...
0.47 0.48 0.49 0.50 0.51 0.53 0.54 0.55 0.56 .7 .81 .8 .9 .99 1 0.6 0.5 0.4 0.33 0.2222 0.1...
0 0.1 0.112 0.52 0.789 0.89 0.900 0.912 0.913 1.00 1.2 1.11 1.23 1.4 1.32 1.5 1.55 1.56 1.57...
1.58 2.5 1.543 1.2 1.1 1.0 1.01 .99 0.823 0.7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91 1.92 1.93 1.94 1.95 1.96 1.97 1.9 2 2.1 2.22 2.3 2.4...
2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.33 3.4 3.5 3.6 3.7 4.0 4.0 4.0 4.0 3.9 3.9...
3.9 3.8 3.7 3.6 3.55 3.5 3.4 3.3 3.2 3.1 3.0 2.9 2.8 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 2.3]% 801 points
V=delt*cumtrapz(a); % V is the velocity of the data
d=delt*cumtrapz(V);% d is displacement of the data
plot(t,a,t,V,t,d)
xlabel('Time (seconds)','fontsize',12,'fontweight','b','color','r');
ylabel('Acceleration (m/s^2), Velocity (m/s), Displacement (m)','fontsize',12,'fontweight','b','color','r');
hleg1 = legend('Acceleration','Velocity','Displacement');
title ('Filtered Acceleration Data for 3/4 or max throttle')
%%
%delt=0.001
V=delt*cumtrapz(a); % V is the velocity of the data
d=delt*cumtrapz(V);% d is displacement of the data
plot(t,a)
xlabel('Time (seconds)','fontsize',12,'fontweight','b','color','r');
ylabel('Acceleration (m/s^2)','fontsize',12,'fontweight','b','color','r');
hleg1 = legend('Acceleration');
title ('Filtered Acceleration Data for 3/4 or max throttle')
%%
plot(t,V)
xlabel('Time (seconds)','fontsize',12,'fontweight','b','color','r');
ylabel('Velocity (m/s)','fontsize',12,'fontweight','b','color','r');
hleg1 = legend('Velocity');
title ('Filtered Velocity Data for 3/4 or max throttle')
%%
plot(t,d)
xlabel('Time (seconds)','fontsize',12,'fontweight','b','color','r');
ylabel('Position (m)','fontsize',12,'fontweight','b','color','r');
hleg1 = legend('Displacement');
title ('Filtered Position Data for 3/4 or max throttle')
Z = TRAPZ(t,a)% Integrate to get vvec
D = TRAPZ(Z)% Integrate to get xvec
%TRAPZ Trapezoidal numerical integration.
%Z = TRAPZ(X,Y) computes the integral of Y with respect to X using
%the trapezoidal method. X and Y must be vectors of the same
%length, or X must be a column vector and Y an array whose first
%non-singleton dimension is length(X). TRAPZ operates along this
%dimension.
_________________________________________________________________
Z =
1.1540
D =
0
Z =
1.1540
D =
0
Z =
1.1540
D =
0
Z =
1.1540
D =
0
Z =
1.1540
D =
0
Z =
1.1540
D =
0
2. Pass acceleration vector through a LPF
H(s) = d/ s+d
d=large (no filter)
d=pi
d small- lots of low pass filter
d large- little low pass filtering
MATLAB CODE:
a=[ 2 2.1 2.5 3 5 4 3.9 1.9 1.2 1.8 2.5 -1.8 1.5 1.3 1.1...
2 4.4 2.3 2.2 1.9 1.8 .5 1 .5 .1 1.9 3 1 -.9 -1.3 .3 .5 1.9 3.9 3 3.2 3.5 -1.5...
1.7 2 1.9 1 2 0.1 -.1 .5 2 3.9 3 2.5 1 -1.5 0 1.5 1 .5 1.7 2 1 0 -1 1 2 4 2 1 0 0.3...
0.5 0.2 0.1 2 1 0 -1.5 0 1 2 4 2 1.8 ]; %81 points
t=[ 0 .01 .02 .03 .04 .05 .06 .07 .08 .09 .1 .11 .12...
.13 .14 .15 .16 .17 .18 .19 .2 .21 .22 .23 .24 .25 .26 .27 .28 .29 .3 .31 .32 .33 .34 .35...
.36 .37 .38 .39 .40 .41 .42 .43 .44 .45 .46 .47 .48 .49 .50 .51 .52 .53 .54 .55...
.56 .57 .58 .59 .60 .61 .62 .63 .64 .65 .66 .67 .68 .69 .70 .71 .72 .73 .74 .75 .76 .77...
.78 .79 .80]; %81 points
num= pi % a= pi given on page 22
den=[1 pi] % denominator of the trasfer function
sys=tf (num,den)
[y,t] = lsim(sys,a,t)
plot(t,y)
xlabel('Time (seconds)','fontsize',12,'fontweight','b','color','r');
ylabel('filtered acceleration (m)','fontsize',12,'fontweight','b','color','r');
hleg1 = legend('Displacement');
title ('Filtered Position Data for 3/4 or max throttle')
grid on
cutoff frequency of 40Hz
Flapping Frequency = 5.6 Hz
[KSS. pg 11] n = the number of components = 10
num= pi % a= pi given on page 22
den=[1 pi] % denominator of the trasfer function
sys=tf (num,den)
bode(sys)
Youtube :
Youtube- Simulink Low pass filter
http://www.youtube.com/watch?v=oDqTg3gweuw
https://ccrma.stanford.edu/~jos/filters/Matlab_Filter_Implementation.html
% simplpm1.m - matlab main program implementing % the simplest lowpass filter: % % y(n) = x(n)+x(n-1)} N=10; % length of test input signal x = 1:N; % test input signal (integer ramp) B = [1,1]; % transfer function numerator A = 1; % transfer function denominator y = filter(B,A,x); for i=1:N disp(sprintf('x(%d)=%f\ty(%d)=%f',i,x(i),i,y(i))); end
Matlab code to construct and apply a low-pass filter to acceleration data
http://nees.org/resources/474/download/Using_MATLAB_to_Analyze_Data_Stored_On_NEEScentral.pdf
3. Look into: Is there a Matlab CFD toolbox?
Should we develop our own?
Process: convert picture to geometry....process geometry to get mesh ....use mesh to solve NS Equations or Euler equations
Youtube:
ODE45 in Matlab