Add flexibility to the sample

This commit is contained in:
Thomas Dehaeze 2020-01-16 11:49:29 +01:00
parent 6356b40f5f
commit c5bb46c184
2 changed files with 8 additions and 7 deletions

View File

@ -1,20 +1,21 @@
function [sample] = initializeSample(sample)
arguments
sample.radius (1,1) double {mustBeNumeric, mustBePositive} = 100
sample.height (1,1) double {mustBeNumeric, mustBePositive} = 300
sample.mass (1,1) double {mustBeNumeric, mustBePositive} = 50
sample.offset (1,1) double {mustBeNumeric} = 0
sample.radius (1,1) double {mustBeNumeric, mustBePositive} = 100 % [mm]
sample.height (1,1) double {mustBeNumeric, mustBePositive} = 300 % [mm]
sample.mass (1,1) double {mustBeNumeric, mustBePositive} = 50 % [kg]
sample.freq (1,1) double {mustBeNumeric, mustBePositive} = 100 % [Hz]
sample.offset (1,1) double {mustBeNumeric} = 0 % [mm]
sample.color (1,3) double {mustBeNumeric} = [0.45, 0.45, 0.45]
end
%%
sample.k.x = 1e8;
sample.k.x = sample.mass * (2*pi * sample.freq)^2;
sample.c.x = 0.1*sqrt(sample.k.x*sample.mass);
sample.k.y = 1e8;
sample.k.y = sample.mass * (2*pi * sample.freq)^2;
sample.c.y = 0.1*sqrt(sample.k.y*sample.mass);
sample.k.z = 1e8;
sample.k.z = sample.mass * (2*pi * sample.freq)^2;
sample.c.z = 0.1*sqrt(sample.k.z*sample.mass);
%% Save