Add parameter to enable/disable all disturbances
This commit is contained in:
		@@ -304,6 +304,8 @@ This Matlab function is accessible [[file:src/initDisturbances.m][here]].
 | 
			
		||||
*** Optional Parameters
 | 
			
		||||
#+begin_src matlab
 | 
			
		||||
  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
 | 
			
		||||
@@ -355,7 +357,7 @@ We define some parameters that will be used in the algorithm.
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
#+begin_src matlab
 | 
			
		||||
  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)))];;
 | 
			
		||||
@@ -366,7 +368,7 @@ We define some parameters that will be used in the algorithm.
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
#+begin_src matlab
 | 
			
		||||
  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)))];;
 | 
			
		||||
@@ -377,7 +379,7 @@ We define some parameters that will be used in the algorithm.
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
#+begin_src matlab
 | 
			
		||||
  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)))];;
 | 
			
		||||
@@ -389,7 +391,7 @@ We define some parameters that will be used in the algorithm.
 | 
			
		||||
 | 
			
		||||
*** Translation Stage - X direction
 | 
			
		||||
#+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
 | 
			
		||||
    C = zeros(N/2,1);
 | 
			
		||||
    for i = 1:N/2
 | 
			
		||||
@@ -407,7 +409,7 @@ We define some parameters that will be used in the algorithm.
 | 
			
		||||
 | 
			
		||||
*** Translation Stage - Z direction
 | 
			
		||||
#+begin_src matlab
 | 
			
		||||
  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
 | 
			
		||||
@@ -425,7 +427,7 @@ We define some parameters that will be used in the algorithm.
 | 
			
		||||
 | 
			
		||||
*** Spindle - Z direction
 | 
			
		||||
#+begin_src matlab
 | 
			
		||||
  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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user