From 49e8efbb02f3d2794d4d23a71f9ea3439bb41c70 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Tue, 10 Sep 2019 16:30:58 +0200 Subject: [PATCH 1/2] rebase --- index.org | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/index.org b/index.org index e778e59..3be1fa4 100644 --- a/index.org +++ b/index.org @@ -1,3 +1,4 @@ +<<<<<<< HEAD #+TITLE:Test of Cercalo :DRAWER: #+STARTUP: overview @@ -10,3 +11,62 @@ #+PROPERTY: header-args:matlab+ :eval no-export #+PROPERTY: header-args:matlab+ :output-dir figs :END: +======= +#+TITLE: Cercalo Test Bench +:DRAWER: +#+STARTUP: overview + +#+LANGUAGE: en +#+EMAIL: dehaeze.thomas@gmail.com +#+AUTHOR: Dehaeze Thomas + +#+PROPERTY: header-args:matlab :session *MATLAB* +#+PROPERTY: header-args:matlab+ :comments org +#+PROPERTY: header-args:matlab+ :results none +#+PROPERTY: header-args:matlab+ :exports both +#+PROPERTY: header-args:matlab+ :eval no-export +#+PROPERTY: header-args:matlab+ :output-dir figs +#+PROPERTY: header-args:matlab+ :tangle matlab/frf_processing.m +#+PROPERTY: header-args:matlab+ :mkdirp yes +:END: + + +* Matlab Init :noexport:ignore: +#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) + <> +#+end_src + +#+begin_src matlab :exports none :results silent :noweb yes + <> +#+end_src + +* Identification of the Plant +#+begin_src matlab + fs = 1e4; + Ts = 1/fs; +#+end_src + +We generate white noise with the "random number" simulink block, and we filter that noise. + +#+begin_src matlab + Gi = (1)/(1+s/2/pi/100); +#+end_src + +#+begin_src matlab :results output replace + c2d(Gi, Ts, 'tustin') +#+end_src + +#+RESULTS: +#+begin_example +c2d(Gi, Ts, 'tustin') + +ans = + + 0.059117 (z+1) + -------------- + (z-0.8818) + +Sample time: 0.0001 seconds +Discrete-time zero/pole/gain model. +#+end_example +>>>>>>> add index.org From 13cf686ad07c21f7c7afb02c1db452e77221f3e3 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Tue, 10 Sep 2019 16:35:11 +0200 Subject: [PATCH 2/2] commit --- index.org | 52 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/index.org b/index.org index 3be1fa4..ede9ad5 100644 --- a/index.org +++ b/index.org @@ -1,17 +1,3 @@ -<<<<<<< HEAD -#+TITLE:Test of Cercalo -:DRAWER: -#+STARTUP: overview -#+HTML_HEAD: - -#+PROPERTY: header-args:matlab :session *MATLAB* -#+PROPERTY: header-args:matlab+ :comments org -#+PROPERTY: header-args:matlab+ :results output -#+PROPERTY: header-args:matlab+ :exports both -#+PROPERTY: header-args:matlab+ :eval no-export -#+PROPERTY: header-args:matlab+ :output-dir figs -:END: -======= #+TITLE: Cercalo Test Bench :DRAWER: #+STARTUP: overview @@ -62,11 +48,43 @@ c2d(Gi, Ts, 'tustin') ans = - 0.059117 (z+1) + 0.030459 (z+1) -------------- - (z-0.8818) + (z-0.9391) Sample time: 0.0001 seconds Discrete-time zero/pole/gain model. #+end_example ->>>>>>> add index.org + +#+begin_src matlab + load('mat/data_001.mat', 't', 'ux') +#+end_src + +#+begin_src matlab + figure; plot(t, ux) +#+end_src + +#+begin_src matlab + [tf_est, freqs] = tfestimate(ux, yx, hanning(ceil(length(ux)/10)), [], [], fs); + + % h = idfrd(tf_est, freqs*2*pi, Ts); +#+end_src + +#+begin_src matlab +figure; +ax1 = subplot(2, 1, 1); +hold on; +plot(freqs, abs(tf_est),'--') +set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); +ylabel('Amplitude [m/N]'); +hold off; + +ax2 = subplot(2, 1, 2); +hold on; +plot(freqs, mod(180+180/pi*phase(tf_est), 360)-180,'--') +set(gca,'xscale','log'); +ylim([-180, 180]); +yticks([-180, -90, 0, 90, 180]); +xlabel('Frequency [$Hz$]'); ylabel('Phase [deg]'); +hold off; +#+end_src