44 lines
1.4 KiB
Matlab
44 lines
1.4 KiB
Matlab
Fs = 10e3; % Sampling Frequency [Hz]
|
|
Ts = 1/Fs; % Sampling Time [s]
|
|
|
|
Tsim = 110; % Simulation Time [s]
|
|
|
|
Trec_start = 5; % Start time for Recording [s]
|
|
Trec_dur = 100; % Recording Duration [s]
|
|
|
|
%% Sweep Sine
|
|
V_sweep = generateSweepExc('Ts', Ts, ...
|
|
'f_start', 10, ...
|
|
'f_end', 1e3, ...
|
|
'V_mean', 3.25, ...
|
|
't_start', Trec_start, ...
|
|
'exc_duration', Trec_dur, ...
|
|
'sweep_type', 'log', ...
|
|
'V_exc', 0.5/(1 + s/2/pi/100));
|
|
|
|
%% Shaped Noise
|
|
V_noise = generateShapedNoise('Ts', 1/Fs, ...
|
|
'V_mean', 3.25, ...
|
|
't_start', Trec_start, ...
|
|
'exc_duration', Trec_dur, ...
|
|
'smooth_ends', true, ...
|
|
'V_exc', 0.05/(1 + s/2/pi/10));
|
|
|
|
%% Select the excitation signal
|
|
V_exc = V_noise;
|
|
|
|
figure;
|
|
tiledlayout(1, 2, 'TileSpacing', 'Normal', 'Padding', 'None');
|
|
|
|
ax1 = nexttile;
|
|
plot(V_exc(1,:), V_exc(2,:));
|
|
xlabel('Time [s]'); ylabel('Amplitude [V]');
|
|
|
|
ax2 = nexttile;
|
|
win = hanning(floor(length(V_exc)/8));
|
|
[pxx, f] = pwelch(V_exc(2,:), win, 0, [], Fs);
|
|
plot(f, pxx)
|
|
xlabel('Frequency [Hz]'); ylabel('Power Spectral Density [$V^2/Hz$]');
|
|
set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log');
|
|
xlim([1, Fs/2]); ylim([1e-10, 1e0]);
|