diff --git a/content/zettels/system_identification.md b/content/zettels/system_identification.md index b75fa98..f131beb 100644 --- a/content/zettels/system_identification.md +++ b/content/zettels/system_identification.md @@ -174,6 +174,8 @@ There are several choices for excitation signals: - Random noise, Periodic signals (PRBS) - Multi-Sine +A good review is given in <&pintelon12_system_ident> (chapter 5). + ### Random noise with specific ASD {#random-noise-with-specific-asd} @@ -271,9 +273,71 @@ T\_{\text{exc}} = \frac{10}{1} = 10\\,s ### Multi-Sine {#multi-sine} +Multi-sine signal excitation has many advantages as compared to random noise: + +- the signal power at each frequency can be precisely chosen +- the signal is periodic and therefore necessitate no windowing (therefore increasing the obtained FRF quality) + +It can be generated with the following code. + +```matlab +%% Generate multinsine signal +Fs = 1e3; % Sampling Frequency [Hz] +Ns = 1e3; % Signal length [-] + +f = linspace(0, Fs/2, Ns/2); % Frequency Vector [Hz] + +% Define the wanted ASD of the test signal [unit/sqrt(Hz)] +wanted_asd = 3*ones(1,Ns); +f_min = 10; % [Hz] +f_max = 300; % [Hz] +wanted_asd([1:round(Ns*f_min/Fs)]) = 0; +wanted_asd([round(Ns*f_max/Fs+1):end]) = 0; + +% Generate the multi-sine signal +u = generate_multisine(Fs, Ns, ... + 'asd', wanted_asd, ... + 'type', 'schroeder'); +``` + +The ASD of the generated signal is exactly as expected (Figure ) + +```matlab +[pxx, f] = pwelch(u, ones(Ns,1), [], Ns, Fs); +``` + + + +{{< figure src="/ox-hugo/system_identification_multi_sine_asd.png" caption="Figure 7: Amplitude Spectral Density of the multi-sine signal" >}} + +In the time domain, it is shown in Figure . + + + +{{< figure src="/ox-hugo/system_identification_multi_sine_time.png" caption="Figure 8: Generated Multi-Sine signal" >}} + +Then, the open-loop identification is performed, and the FRF is computed using the following code (not that no window is being used!). +Only the first period (here of 1s) is discarded to remove transient effects. + +```matlab +% Skip the first period (transient) +[Gm, f] = tfestimate(data.du(Ns:end), data.y(Ns:end), ones(Ns,1), [], Ns, Fs); +``` + +The obtained FRF is shown in Figure . +The quality of the obtained FRF is only good in the defined range. + + + +{{< figure src="/ox-hugo/system_identification_multi_sine_frf.png" caption="Figure 9: Obtained FRF using the multi-sine excitation signal" >}} + ### `generatemultisine` - Matlab Function {#generatemultisine-matlab-function} +The synthesis of multi-sine with minimal "crest factor" is taken from <&schroeder70_synth_low_peak_factor_signal>. + +The Matlab code is adapted from [here](https://bholmesqub.github.io/thesis/chapters/identification-design/multi-sine/). + ```matlab function y = generate_multisine(Fs, Ns, args) %% Input parsing @@ -339,7 +403,6 @@ end % Binary Sequences With Low Autocorrelation" by M. R. Schroeder function phase = schroederPhases(Ns, mag) rel_mag = mag./sum(mag); % Normalize magnitude for Schroeder's algorithm - sum(rel_mag) phase = zeros(1, Ns); for nn=2:floor(Ns/2+1) ll=1:(nn-1); diff --git a/static/ox-hugo/system_identification_multi_sine_asd.png b/static/ox-hugo/system_identification_multi_sine_asd.png new file mode 100644 index 0000000..64d7ace Binary files /dev/null and b/static/ox-hugo/system_identification_multi_sine_asd.png differ diff --git a/static/ox-hugo/system_identification_multi_sine_frf.png b/static/ox-hugo/system_identification_multi_sine_frf.png new file mode 100644 index 0000000..9793509 Binary files /dev/null and b/static/ox-hugo/system_identification_multi_sine_frf.png differ diff --git a/static/ox-hugo/system_identification_multi_sine_time.png b/static/ox-hugo/system_identification_multi_sine_time.png new file mode 100644 index 0000000..55908fa Binary files /dev/null and b/static/ox-hugo/system_identification_multi_sine_time.png differ diff --git a/static/ox-hugo/system_identification_ol_comp_plant.png b/static/ox-hugo/system_identification_ol_comp_plant.png index b77c313..5256906 100644 Binary files a/static/ox-hugo/system_identification_ol_comp_plant.png and b/static/ox-hugo/system_identification_ol_comp_plant.png differ