Add folder for Matlab functions
This commit is contained in:
parent
0ead56a3a1
commit
627859f026
78
src/index.org
Normal file
78
src/index.org
Normal file
@ -0,0 +1,78 @@
|
||||
#+TITLE: Matlab Function useful for the analysis
|
||||
|
||||
* voltageToVelocityL22
|
||||
:PROPERTIES:
|
||||
:header-args:matlab+: :tangle voltageToVelocityL22.m
|
||||
:header-args:matlab+: :comments none :mkdirp yes
|
||||
:header-args:matlab+: :eval no :results none
|
||||
:END:
|
||||
<<sec:voltageToVelocityL22>>
|
||||
|
||||
This Matlab function is accessible [[file:voltageToVelocityL22.m][here]].
|
||||
|
||||
#+begin_src matlab
|
||||
function [velocity] = voltageToVelocityL22(voltage, time, gain)
|
||||
% voltageToVelocityL22 -
|
||||
%
|
||||
% Syntax: [velocity] = voltageToVelocityL22(voltage, time, gain)
|
||||
%
|
||||
% Inputs:
|
||||
% - voltage - Measured voltage
|
||||
% - time - Time vector
|
||||
% - gain - Gain of the voltage amplifier in dB
|
||||
%
|
||||
% Outputs:
|
||||
% - velocity -
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
s = zpk('s');
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
S0 = 88; % Sensitivity [V/(m/s)]
|
||||
f0 = 2; % Cut-off frequnecy [Hz]
|
||||
|
||||
S = S0*(s/2/pi/f0)/(1+s/2/pi/f0);
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
velocity = lsim((S*10^(gain/20))\1, voltage, time);
|
||||
#+end_src
|
||||
|
||||
* voltageToDisplacementL22
|
||||
:PROPERTIES:
|
||||
:header-args:matlab+: :tangle voltageToDisplacementL22.m
|
||||
:header-args:matlab+: :comments none :mkdirp yes
|
||||
:header-args:matlab+: :eval no :results none
|
||||
:END:
|
||||
<<sec:voltageToDisplacementL22>>
|
||||
|
||||
This Matlab function is accessible [[file:voltageToDisplacementL22.m][here]].
|
||||
|
||||
#+begin_src matlab
|
||||
function [disp] = voltageToDisplacementL22(voltage, time, gain)
|
||||
% voltageToDisplacementL22 -
|
||||
%
|
||||
% Syntax: [disp] = voltageToDisplacementL22(voltage, time, gain)
|
||||
%
|
||||
% Inputs:
|
||||
% - voltage - Measured voltage
|
||||
% - time - Time vector
|
||||
% - gain - Gain of the voltage amplifier in dB
|
||||
%
|
||||
% Outputs:
|
||||
% - disp -
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
s = zpk('s');
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
voltage = voltage - mean(voltage);
|
||||
|
||||
velocity = voltageToVelocityL22(voltage, time, gain);
|
||||
|
||||
disp = lsim(1/s, velocity, time);
|
||||
#+end_src
|
20
src/voltageToDisplacementL22.m
Normal file
20
src/voltageToDisplacementL22.m
Normal file
@ -0,0 +1,20 @@
|
||||
function [disp] = voltageToDisplacementL22(voltage, time, gain)
|
||||
% voltageToDisplacementL22 -
|
||||
%
|
||||
% Syntax: [disp] = voltageToDisplacementL22(voltage, time, gain)
|
||||
%
|
||||
% Inputs:
|
||||
% - voltage - Measured voltage
|
||||
% - time - Time vector
|
||||
% - gain - Gain of the voltage amplifier in dB
|
||||
%
|
||||
% Outputs:
|
||||
% - disp -
|
||||
|
||||
s = zpk('s');
|
||||
|
||||
voltage = voltage - mean(voltage);
|
||||
|
||||
velocity = voltageToVelocityL22(voltage, time, gain);
|
||||
|
||||
disp = lsim(1/s, velocity, time);
|
21
src/voltageToVelocityL22.m
Normal file
21
src/voltageToVelocityL22.m
Normal file
@ -0,0 +1,21 @@
|
||||
function [velocity] = voltageToVelocityL22(voltage, time, gain)
|
||||
% voltageToVelocityL22 -
|
||||
%
|
||||
% Syntax: [velocity] = voltageToVelocityL22(voltage, time, gain)
|
||||
%
|
||||
% Inputs:
|
||||
% - voltage - Measured voltage
|
||||
% - time - Time vector
|
||||
% - gain - Gain of the voltage amplifier in dB
|
||||
%
|
||||
% Outputs:
|
||||
% - velocity -
|
||||
|
||||
s = zpk('s');
|
||||
|
||||
S0 = 88; % Sensitivity [V/(m/s)]
|
||||
f0 = 2; % Cut-off frequnecy [Hz]
|
||||
|
||||
S = S0*(s/2/pi/f0)/(1+s/2/pi/f0);
|
||||
|
||||
velocity = lsim((S*10^(gain/20))\1, voltage, time);
|
Loading…
Reference in New Issue
Block a user