Add parameter to enable/disable all disturbances

This commit is contained in:
2020-01-21 15:46:34 +01:00
parent 139ec3cbb8
commit d5a1cbdaea
2 changed files with 16 additions and 12 deletions

View File

@@ -7,6 +7,8 @@ function [] = initDisturbances(args)
% - args -
arguments
% Global parameter to enable or disable the disturbances
args.enable logical {mustBeNumericOrLogical} = true
% Ground Motion - X direction
args.Dwx logical {mustBeNumericOrLogical} = true
% Ground Motion - Y direction
@@ -42,7 +44,7 @@ for i = 1:N/2
C(i) = sqrt(phi(i)*df);
end
if args.Dwx
if args.Dwx && args.enable
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
Cx = [Cx; flipud(conj(Cx(2:end)))];;
@@ -51,7 +53,7 @@ else
Dwx = zeros(length(t), 1);
end
if args.Dwy
if args.Dwy && args.enable
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
Cx = [Cx; flipud(conj(Cx(2:end)))];;
@@ -60,7 +62,7 @@ else
Dwy = zeros(length(t), 1);
end
if args.Dwy
if args.Dwy && args.enable
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
Cx = [Cx; flipud(conj(Cx(2:end)))];;
@@ -69,7 +71,7 @@ else
Dwz = zeros(length(t), 1);
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
C = zeros(N/2,1);
for i = 1:N/2
@@ -84,7 +86,7 @@ else
Fty_x = zeros(length(t), 1);
end
if args.Fty_z
if args.Fty_z && args.enable
phi = dist_f.psd_ty;
C = zeros(N/2,1);
for i = 1:N/2
@@ -99,7 +101,7 @@ else
Fty_z = zeros(length(t), 1);
end
if args.Frz_z
if args.Frz_z && args.enable
phi = dist_f.psd_rz;
C = zeros(N/2,1);
for i = 1:N/2