function [sample] = initializeSample(args) arguments args.type char {mustBeMember(args.type,{'rigid', 'flexible', 'none'})} = 'flexible' args.radius (1,1) double {mustBeNumeric, mustBePositive} = 0.1 % [m] args.height (1,1) double {mustBeNumeric, mustBePositive} = 0.3 % [m] args.mass (1,1) double {mustBeNumeric, mustBePositive} = 50 % [kg] args.freq (1,1) double {mustBeNumeric, mustBePositive} = 100 % [Hz] args.offset (1,1) double {mustBeNumeric} = 0 % [m] args.x0 (1,1) double {mustBeNumeric} = 0 % [m] args.y0 (1,1) double {mustBeNumeric} = 0 % [m] args.z0 (1,1) double {mustBeNumeric} = 0 % [m] end sample = struct(); switch args.type case 'none' sample.type = 0; case 'rigid' sample.type = 1; case 'flexible' sample.type = 2; end sample.radius = args.radius; % [m] sample.height = args.height; % [m] sample.mass = args.mass; % [kg] sample.offset = args.offset; % [m] sample.k.x = sample.mass * (2*pi * args.freq)^2; % [N/m] sample.k.y = sample.mass * (2*pi * args.freq)^2; % [N/m] sample.k.z = sample.mass * (2*pi * args.freq)^2; % [N/m] sample.c.x = 0.1*sqrt(sample.k.x*sample.mass); % [N/(m/s)] sample.c.y = 0.1*sqrt(sample.k.y*sample.mass); % [N/(m/s)] sample.c.z = 0.1*sqrt(sample.k.z*sample.mass); % [N/(m/s)] sample.x0 = args.x0; % [m] sample.y0 = args.y0; % [m] sample.z0 = args.z0; % [m] save('./mat/stages.mat', 'sample', '-append');