nass-simscape/src/initializeSample.m

24 lines
935 B
Mathematica
Raw Normal View History

function [sample] = initializeSample(sample)
arguments
2020-01-16 11:49:29 +01:00
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]
2018-06-16 22:57:54 +02:00
end
2018-10-25 11:00:30 +02:00
%%
2020-01-16 11:49:29 +01:00
sample.k.x = sample.mass * (2*pi * sample.freq)^2;
2019-11-22 10:36:26 +01:00
sample.c.x = 0.1*sqrt(sample.k.x*sample.mass);
2018-06-16 22:57:54 +02:00
2020-01-16 11:49:29 +01:00
sample.k.y = sample.mass * (2*pi * sample.freq)^2;
2019-11-22 10:36:26 +01:00
sample.c.y = 0.1*sqrt(sample.k.y*sample.mass);
2018-10-25 11:00:30 +02:00
2020-01-16 11:49:29 +01:00
sample.k.z = sample.mass * (2*pi * sample.freq)^2;
2019-11-22 10:36:26 +01:00
sample.c.z = 0.1*sqrt(sample.k.z*sample.mass);
2018-10-25 11:00:30 +02:00
%% Save
save('./mat/stages.mat', 'sample', '-append');
2018-06-16 22:57:54 +02:00
end