Compare commits
No commits in common. "21abe53df051a0aa817f42db6099cc156042c170" and "1910b3bd1e99c0709d982f7c9fb3e34053070e29" have entirely different histories.
21abe53df0
...
1910b3bd1e
Binary file not shown.
@ -11,7 +11,7 @@ addpath('./src/');
|
|||||||
%% Load measurement data for APA number 1
|
%% Load measurement data for APA number 1
|
||||||
strut_number = 1;
|
strut_number = 1;
|
||||||
% load(sprintf('mat/frf_data_exc_strut_%i_noise_lf.mat', strut_number), 't', 'Va', 'Vs', 'de');
|
% load(sprintf('mat/frf_data_exc_strut_%i_noise_lf.mat', strut_number), 't', 'Va', 'Vs', 'de');
|
||||||
load(sprintf('mat/iff_strut_%i_noise.mat', strut_number), 't', 'Va', 'Vs', 'de');
|
load(sprintf('mat/frf_data_exc_strut_%i_noise_hf.mat', strut_number), 't', 'Va', 'Vs', 'de');
|
||||||
|
|
||||||
% Compute transfer functions:
|
% Compute transfer functions:
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ Fs = 1/Ts;
|
|||||||
win = hanning(ceil(1*Fs)); % Hannning Windows
|
win = hanning(ceil(1*Fs)); % Hannning Windows
|
||||||
|
|
||||||
%% DVF
|
%% DVF
|
||||||
[G_dvf, f] = tfestimate(Vexc, de, win, [], [], 1/Ts);
|
[G_dvf, f] = tfestimate(Va, de, win, [], [], 1/Ts);
|
||||||
|
|
||||||
figure;
|
figure;
|
||||||
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
|
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
|
||||||
|
@ -19,16 +19,15 @@ data = SimulinkRealTime.utils.getFileScopeData('data/data.dat').data;
|
|||||||
|
|
||||||
de = data(:, 1:6); % Measurment displacement (encoder) [m]
|
de = data(:, 1:6); % Measurment displacement (encoder) [m]
|
||||||
Vs = data(:, 7:12); % Measured voltage (force sensor) [V]
|
Vs = data(:, 7:12); % Measured voltage (force sensor) [V]
|
||||||
u = data(:, 13:18); % DAC Voltage (command) [V]
|
Va = data(:, 13); % Excitation Voltage [V]
|
||||||
Vexc = data(:, 19); % Excitation Voltage [V]
|
|
||||||
t = data(:, end); % Time [s]
|
t = data(:, end); % Time [s]
|
||||||
|
|
||||||
|
|
||||||
% And we save this to a =mat= file:
|
% And we save this to a =mat= file:
|
||||||
strut_number = 6;
|
strut_number = 6;
|
||||||
|
|
||||||
save(sprintf('mat/iff_strut_%i_noise_g_400.mat', strut_number), 't', 'u', 'Vs', 'Vexc', 'de');
|
% save(sprintf('mat/frf_data_exc_strut_%i_noise.mat', strut_number), 't', 'Va', 'Vs', 'de');
|
||||||
% save(sprintf('mat/frf_data_exc_strut_%i_noise_lf.mat', strut_number), 't', 'u', 'Vs', 'de');
|
% save(sprintf('mat/frf_data_exc_strut_%i_noise_lf.mat', strut_number), 't', 'Va', 'Vs', 'de');
|
||||||
% save(sprintf('mat/frf_data_exc_strut_%i_sweep.mat', strut_number), 't', 'u', 'Vs', 'de');
|
% save(sprintf('mat/frf_data_exc_strut_%i_sweep.mat', strut_number), 't', 'Va', 'Vs', 'de');
|
||||||
% save(sprintf('mat/iff_strut_%i_noise_hf.mat', strut_number), 't', 'u', 'Vs', 'de');
|
save(sprintf('mat/frf_data_exc_strut_%i_noise_hf.mat', strut_number), 't', 'Va', 'Vs', 'de');
|
||||||
% save(sprintf('mat/frf_data_exc_strut_%i_add_mass_closed_circuit.mat', strut_number), 't', 'u', 'Vs', 'de');
|
% save(sprintf('mat/frf_data_exc_strut_%i_add_mass_closed_circuit.mat', strut_number), 't', 'Va', 'Vs', 'de');
|
||||||
|
@ -16,17 +16,13 @@ Trec_dur = 100; % Recording Duration [s]
|
|||||||
|
|
||||||
Tsim = 2*Trec_start + Trec_dur; % Simulation Time [s]
|
Tsim = 2*Trec_start + Trec_dur; % Simulation Time [s]
|
||||||
|
|
||||||
%% Security
|
|
||||||
u_min = -1;
|
|
||||||
u_max = 6;
|
|
||||||
|
|
||||||
%% Shaped Noise
|
%% Shaped Noise
|
||||||
V_noise = generateShapedNoise('Ts', 1/Fs, ...
|
V_noise = generateShapedNoise('Ts', 1/Fs, ...
|
||||||
'V_mean', 0, ...
|
'V_mean', 3.25, ...
|
||||||
't_start', Trec_start, ...
|
't_start', Trec_start, ...
|
||||||
'exc_duration', Trec_dur, ...
|
'exc_duration', Trec_dur, ...
|
||||||
'smooth_ends', true, ...
|
'smooth_ends', true, ...
|
||||||
'V_exc', 0.05/(1 + s/2/pi/10));
|
'V_exc', 0.05/(1 + s/2/pi/10));
|
||||||
|
|
||||||
%% Sweep Sine
|
%% Sweep Sine
|
||||||
gc = 0.1;
|
gc = 0.1;
|
||||||
@ -37,72 +33,76 @@ wn = 2*pi*92.7;
|
|||||||
G_sweep = 0.2*(s^2 + 2*gc*xi*wn*s + wn^2)/(s^2 + 2*xi*wn*s + wn^2);
|
G_sweep = 0.2*(s^2 + 2*gc*xi*wn*s + wn^2)/(s^2 + 2*xi*wn*s + wn^2);
|
||||||
|
|
||||||
V_sweep = generateSweepExc('Ts', Ts, ...
|
V_sweep = generateSweepExc('Ts', Ts, ...
|
||||||
'f_start', 10, ...
|
'f_start', 10, ...
|
||||||
'f_end', 400, ...
|
'f_end', 400, ...
|
||||||
'V_mean', 0, ...
|
'V_mean', 3.25, ...
|
||||||
't_start', Trec_start, ...
|
't_start', Trec_start, ...
|
||||||
'exc_duration', Trec_dur, ...
|
'exc_duration', Trec_dur, ...
|
||||||
'sweep_type', 'log', ...
|
'sweep_type', 'log', ...
|
||||||
'V_exc', G_sweep*1/(1 + s/2/pi/500));
|
'V_exc', G_sweep*1/(1 + s/2/pi/500));
|
||||||
|
|
||||||
V_sweep_lf = generateSweepExc('Ts', Ts, ...
|
V_sweep_lf = generateSweepExc('Ts', Ts, ...
|
||||||
'f_start', 0.1, ...
|
'f_start', 0.1, ...
|
||||||
'f_end', 10, ...
|
'f_end', 10, ...
|
||||||
'V_mean', 0, ...
|
'V_mean', 3.25, ...
|
||||||
't_start', Trec_start, ...
|
't_start', Trec_start, ...
|
||||||
'exc_duration', Trec_dur, ...
|
'exc_duration', Trec_dur, ...
|
||||||
'sweep_type', 'log', ...
|
'sweep_type', 'log', ...
|
||||||
'V_exc', 0.2);
|
'V_exc', 0.2);
|
||||||
|
|
||||||
%% High Frequency Shaped Noise
|
%% High Frequency Shaped Noise
|
||||||
[b,a] = cheby1(10, 2, 2*pi*[240 2e3], 'bandpass', 's');
|
[b,a] = cheby1(10, 2, 2*pi*[240 2e3], 'bandpass', 's');
|
||||||
wL = 0.005*tf(b, a);
|
wL = 0.005*tf(b, a);
|
||||||
|
|
||||||
V_noise_hf = generateShapedNoise('Ts', 1/Fs, ...
|
V_noise_hf = generateShapedNoise('Ts', 1/Fs, ...
|
||||||
'V_mean', 0, ...
|
'V_mean', 3.25, ...
|
||||||
't_start', Trec_start, ...
|
't_start', Trec_start, ...
|
||||||
'exc_duration', Trec_dur, ...
|
'exc_duration', Trec_dur, ...
|
||||||
'smooth_ends', true, ...
|
'smooth_ends', true, ...
|
||||||
'V_exc', wL);
|
'V_exc', wL);
|
||||||
|
|
||||||
%% Low Frequency Shaped Noise
|
%% Low Frequency Shaped Noise
|
||||||
[b,a] = cheby1(10, 2, 2*pi*[10 260], 'bandpass', 's');
|
[b,a] = cheby1(10, 2, 2*pi*[10 260], 'bandpass', 's');
|
||||||
wL = 0.005*tf(b, a);
|
wL = 0.005*tf(b, a);
|
||||||
|
|
||||||
V_noise_lf = generateShapedNoise('Ts', 1/Fs, ...
|
V_noise_lf = generateShapedNoise('Ts', 1/Fs, ...
|
||||||
'V_mean', 0, ...
|
'V_mean', 3.25, ...
|
||||||
't_start', Trec_start, ...
|
't_start', Trec_start, ...
|
||||||
'exc_duration', Trec_dur, ...
|
'exc_duration', Trec_dur, ...
|
||||||
'smooth_ends', true, ...
|
'smooth_ends', true, ...
|
||||||
'V_exc', wL);
|
'V_exc', wL);
|
||||||
|
|
||||||
%% Sinus excitation with increasing amplitude
|
%% Sinus excitation with increasing amplitude
|
||||||
V_sin = generateSinIncreasingAmpl('Ts', 1/Fs, ...
|
V_sin = generateSinIncreasingAmpl('Ts', 1/Fs, ...
|
||||||
'V_mean', 0, ...
|
'V_mean', 3.25, ...
|
||||||
'sin_ampls', [0.1, 0.2, 0.4, 1, 2, 4], ...
|
'sin_ampls', [0.1, 0.2, 0.4, 1, 2, 4], ...
|
||||||
'sin_period', 1, ...
|
'sin_period', 1, ...
|
||||||
'sin_num', 5, ...
|
'sin_num', 5, ...
|
||||||
't_start', Trec_start, ...
|
't_start', Trec_start, ...
|
||||||
'smooth_ends', true);
|
'smooth_ends', true);
|
||||||
|
|
||||||
|
%% Zero Excitation
|
||||||
|
Trec_start = 10; % Start time for Recording [s]
|
||||||
|
Trec_dur = 10; % Recording Duration [s]
|
||||||
|
|
||||||
|
Tsim = 2*Trec_start + Trec_dur; % Simulation Time [s]
|
||||||
|
|
||||||
%% Offset Voltage for all APA
|
|
||||||
V_zero = generateShapedNoise('Ts', 1/Fs, ...
|
V_zero = generateShapedNoise('Ts', 1/Fs, ...
|
||||||
'V_mean', 3.25, ...
|
'V_mean', 1.25, ...
|
||||||
't_start', Trec_start, ...
|
't_start', Trec_start, ...
|
||||||
'exc_duration', Trec_dur, ...
|
'exc_duration', Trec_dur, ...
|
||||||
'smooth_ends', true, ...
|
'smooth_ends', true, ...
|
||||||
'V_exc', tf(0));
|
'V_exc', tf(0));
|
||||||
|
|
||||||
%% Select the excitation signal and offset voltage
|
%% Select the excitation signal
|
||||||
V_exc = timeseries(V_noise(2,:), V_noise(1,:));
|
V_exc = timeseries(V_zero(2,:), V_zero(1,:));
|
||||||
V_off = timeseries(V_zero(2,:), V_zero(1,:));
|
|
||||||
|
|
||||||
%% Plot
|
%% Plot
|
||||||
figure;
|
figure;
|
||||||
tiledlayout(1, 2, 'TileSpacing', 'Normal', 'Padding', 'None');
|
tiledlayout(1, 2, 'TileSpacing', 'Normal', 'Padding', 'None');
|
||||||
|
|
||||||
ax1 = nexttile;
|
ax1 = nexttile;
|
||||||
plot(V_exc.Time, squeeze(V_exc.Data+V_off.Data));
|
plot(V_exc.Time, squeeze(V_exc.Data));
|
||||||
xlabel('Time [s]'); ylabel('Amplitude [V]');
|
xlabel('Time [s]'); ylabel('Amplitude [V]');
|
||||||
|
|
||||||
ax2 = nexttile;
|
ax2 = nexttile;
|
||||||
|
Binary file not shown.
@ -9,11 +9,4 @@ Kiff_g1 = (1/(s + 2*pi*40))*... % Low pass filter (provides integral action abov
|
|||||||
Kiff = c2d(Kiff_g1, Ts, 'tustin');
|
Kiff = c2d(Kiff_g1, Ts, 'tustin');
|
||||||
|
|
||||||
%%
|
%%
|
||||||
save('./frf_data.mat', 'Fs', ...
|
save('./frf_data.mat', 'Fs', 'Ts', 'Tsim', 'Trec_start', 'Trec_dur', 'V_exc', 'Kiff');
|
||||||
'Ts', ...
|
|
||||||
'Tsim', ...
|
|
||||||
'Trec_start', ...
|
|
||||||
'Trec_dur', ...
|
|
||||||
'V_exc', ...
|
|
||||||
'V_off', ...
|
|
||||||
'Kiff');
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user