Add parameter to enable/disable all disturbances
This commit is contained in:
parent
139ec3cbb8
commit
d5a1cbdaea
@ -304,6 +304,8 @@ This Matlab function is accessible [[file:src/initDisturbances.m][here]].
|
|||||||
*** Optional Parameters
|
*** Optional Parameters
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
arguments
|
arguments
|
||||||
|
% Global parameter to enable or disable the disturbances
|
||||||
|
args.enable logical {mustBeNumericOrLogical} = true
|
||||||
% Ground Motion - X direction
|
% Ground Motion - X direction
|
||||||
args.Dwx logical {mustBeNumericOrLogical} = true
|
args.Dwx logical {mustBeNumericOrLogical} = true
|
||||||
% Ground Motion - Y direction
|
% Ground Motion - Y direction
|
||||||
@ -355,7 +357,7 @@ We define some parameters that will be used in the algorithm.
|
|||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
if args.Dwx
|
if args.Dwx && args.enable
|
||||||
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
||||||
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
||||||
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
||||||
@ -366,7 +368,7 @@ We define some parameters that will be used in the algorithm.
|
|||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
if args.Dwy
|
if args.Dwy && args.enable
|
||||||
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
||||||
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
||||||
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
||||||
@ -377,7 +379,7 @@ We define some parameters that will be used in the algorithm.
|
|||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
if args.Dwy
|
if args.Dwy && args.enable
|
||||||
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
||||||
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
||||||
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
||||||
@ -389,7 +391,7 @@ We define some parameters that will be used in the algorithm.
|
|||||||
|
|
||||||
*** Translation Stage - X direction
|
*** Translation Stage - X direction
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
if args.Fty_x
|
if args.Fty_x && args.enable
|
||||||
phi = dist_f.psd_ty; % TODO - we take here the vertical direction which is wrong but approximate
|
phi = dist_f.psd_ty; % TODO - we take here the vertical direction which is wrong but approximate
|
||||||
C = zeros(N/2,1);
|
C = zeros(N/2,1);
|
||||||
for i = 1:N/2
|
for i = 1:N/2
|
||||||
@ -407,7 +409,7 @@ We define some parameters that will be used in the algorithm.
|
|||||||
|
|
||||||
*** Translation Stage - Z direction
|
*** Translation Stage - Z direction
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
if args.Fty_z
|
if args.Fty_z && args.enable
|
||||||
phi = dist_f.psd_ty;
|
phi = dist_f.psd_ty;
|
||||||
C = zeros(N/2,1);
|
C = zeros(N/2,1);
|
||||||
for i = 1:N/2
|
for i = 1:N/2
|
||||||
@ -425,7 +427,7 @@ We define some parameters that will be used in the algorithm.
|
|||||||
|
|
||||||
*** Spindle - Z direction
|
*** Spindle - Z direction
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
if args.Frz_z
|
if args.Frz_z && args.enable
|
||||||
phi = dist_f.psd_rz;
|
phi = dist_f.psd_rz;
|
||||||
C = zeros(N/2,1);
|
C = zeros(N/2,1);
|
||||||
for i = 1:N/2
|
for i = 1:N/2
|
||||||
|
@ -7,6 +7,8 @@ function [] = initDisturbances(args)
|
|||||||
% - args -
|
% - args -
|
||||||
|
|
||||||
arguments
|
arguments
|
||||||
|
% Global parameter to enable or disable the disturbances
|
||||||
|
args.enable logical {mustBeNumericOrLogical} = true
|
||||||
% Ground Motion - X direction
|
% Ground Motion - X direction
|
||||||
args.Dwx logical {mustBeNumericOrLogical} = true
|
args.Dwx logical {mustBeNumericOrLogical} = true
|
||||||
% Ground Motion - Y direction
|
% Ground Motion - Y direction
|
||||||
@ -42,7 +44,7 @@ for i = 1:N/2
|
|||||||
C(i) = sqrt(phi(i)*df);
|
C(i) = sqrt(phi(i)*df);
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.Dwx
|
if args.Dwx && args.enable
|
||||||
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
||||||
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
||||||
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
||||||
@ -51,7 +53,7 @@ else
|
|||||||
Dwx = zeros(length(t), 1);
|
Dwx = zeros(length(t), 1);
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.Dwy
|
if args.Dwy && args.enable
|
||||||
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
||||||
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
||||||
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
||||||
@ -60,7 +62,7 @@ else
|
|||||||
Dwy = zeros(length(t), 1);
|
Dwy = zeros(length(t), 1);
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.Dwy
|
if args.Dwy && args.enable
|
||||||
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
||||||
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
||||||
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
||||||
@ -69,7 +71,7 @@ else
|
|||||||
Dwz = zeros(length(t), 1);
|
Dwz = zeros(length(t), 1);
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.Fty_x
|
if args.Fty_x && args.enable
|
||||||
phi = dist_f.psd_ty; % TODO - we take here the vertical direction which is wrong but approximate
|
phi = dist_f.psd_ty; % TODO - we take here the vertical direction which is wrong but approximate
|
||||||
C = zeros(N/2,1);
|
C = zeros(N/2,1);
|
||||||
for i = 1:N/2
|
for i = 1:N/2
|
||||||
@ -84,7 +86,7 @@ else
|
|||||||
Fty_x = zeros(length(t), 1);
|
Fty_x = zeros(length(t), 1);
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.Fty_z
|
if args.Fty_z && args.enable
|
||||||
phi = dist_f.psd_ty;
|
phi = dist_f.psd_ty;
|
||||||
C = zeros(N/2,1);
|
C = zeros(N/2,1);
|
||||||
for i = 1:N/2
|
for i = 1:N/2
|
||||||
@ -99,7 +101,7 @@ else
|
|||||||
Fty_z = zeros(length(t), 1);
|
Fty_z = zeros(length(t), 1);
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.Frz_z
|
if args.Frz_z && args.enable
|
||||||
phi = dist_f.psd_rz;
|
phi = dist_f.psd_rz;
|
||||||
C = zeros(N/2,1);
|
C = zeros(N/2,1);
|
||||||
for i = 1:N/2
|
for i = 1:N/2
|
||||||
|
Loading…
Reference in New Issue
Block a user