├── @idafflpv ├── bodemag.m ├── c2d.m ├── d2c.m ├── display.m ├── findstates.m ├── idafflpv.m ├── idafflpv2idss.m ├── idafflpv2ss.m ├── idafflpvA2idss.m ├── iosize.m ├── isct.m ├── isdt.m ├── isempty.m ├── issiso.m ├── isstatic.m ├── order.m ├── pe.m ├── pem.m ├── predict.m ├── predictor.m ├── predstab.m ├── private │ ├── allcomb.m │ ├── checkMatrixData.m │ ├── checkMatrixDims.m │ ├── getABCD.m │ ├── getABCDK.m │ ├── khatrirao.m │ ├── lpv2par.m │ ├── lpvfun.m │ ├── lpvitr.c │ ├── lpvitr.m │ ├── lpvitr.mexw64 │ ├── lpvopt.m │ ├── lpvsim.m │ └── par2lpv.m ├── resid.m ├── sim.m ├── size.m ├── ssdata.m ├── subsasgn.m └── subsref.m ├── README.md ├── abc2idss.m ├── abcd2idss.m ├── abcdk2idss.m ├── abck2idss.m ├── cubici1.m ├── cubici2.m ├── cubici3.m ├── dbode.m ├── dbodemag.m ├── dbodemagpatch.m ├── dbodemagsd.m ├── dbodepatch.m ├── dbodesd.m ├── deigen.m ├── deigensd.m ├── dmodx.m ├── dnyquist.m ├── dnyquistdet.m ├── dnyquistdetsd.m ├── dnyquistsd.m ├── doc ├── Houtzager_CDC09.pdf ├── Houtzager_CompressedMarkov.pdf ├── Houtzager_LSL.pdf ├── Houtzager_SYSID09.pdf ├── Wingerden_Automatica09.pdf ├── Wingerden_CDC08.pdf ├── Wingerden_CDC09.pdf ├── Wingerden_IJRNC09.pdf ├── Wingerden_SYSID09.pdf ├── Wingerden_a_variance_PBSIDopt.pdf ├── html │ ├── TULogo.gif │ ├── Thumbs.db │ ├── pbsid_examples.html │ ├── pbsid_func_alpha.html │ ├── pbsid_func_cat.html │ ├── pbsid_install.html │ ├── pbsid_releasenotes.html │ └── subspace.png ├── pbsid_examples.m ├── pbsid_func_alpha.m ├── pbsid_func_cat.m ├── pbsid_install.m └── pbsid_releasenotes.m ├── dordfir.m ├── dordvarmax.m ├── dordvarx.m ├── dvar2eig.m ├── dvar2frd.m ├── dvar4abcdk.m ├── dvar4abck.m ├── dvar4varx.m ├── dvar4varx_CTOR.m ├── dvar4varxbatch.m ├── dx2abc.m ├── dx2abcd.m ├── dx2abcdk.m ├── dx2abck.m ├── examples ├── SfunctionLPV.m ├── SwtsLPV.mdl ├── dplqr.m ├── ex01_lti_four.m ├── ex02_lti_four_fir.m ├── ex03_lti_duct.m ├── ex04_lti_wts.m ├── ex05_lti_wts_batch.m ├── ex06_lti_four_unc.m ├── ex07_lti_wts_mcs.m ├── ex08_lti_wts_bootstrap.m ├── ex09_lti_plus_periodic_rotor.m ├── ex10_rlti_fast.m ├── ex11_rlti_slow.m ├── ex12_rlti_fast_closed.m ├── ex13_rlti_slow_closed.m ├── ex14_hamm_four.m ├── ex15_wiener_four.m ├── ex16_hammwiener_four.m ├── ex17_c2d_f16.m ├── ex18_c2d_flutter.m ├── ex19_lpv_flap.m ├── ex19b_lpv_stable_predictor.m ├── ex19c_lpv_sparse.m ├── ex20_lpv_mimo.m ├── ex21_plpv_flap.m ├── ex22_plpv_mimo.m ├── ex23_plpv_wts.m ├── html │ ├── ex01_lti_four.html │ ├── ex01_lti_four.png │ ├── ex01_lti_four_01.png │ ├── ex01_lti_four_02.png │ ├── ex01_lti_four_03.png │ ├── ex01_lti_four_04.png │ ├── ex01_lti_four_05.png │ ├── ex01_lti_four_06.png │ ├── ex01_lti_four_07.png │ ├── ex01_lti_four_08.png │ ├── ex02_lti_four_fir.html │ ├── ex02_lti_four_fir.png │ ├── ex02_lti_four_fir_01.png │ ├── ex02_lti_four_fir_02.png │ ├── ex02_lti_four_fir_03.png │ ├── ex02_lti_four_fir_04.png │ ├── ex02_lti_four_fir_05.png │ ├── ex02_lti_four_fir_06.png │ ├── ex02_lti_four_fir_07.png │ ├── ex02_lti_four_fir_08.png │ ├── ex03_lti_duct.html │ ├── ex03_lti_duct.png │ ├── ex03_lti_duct_01.png │ ├── ex03_lti_duct_02.png │ ├── ex03_lti_duct_03.png │ ├── ex03_lti_duct_04.png │ ├── ex03_lti_duct_05.png │ ├── ex03_lti_duct_06.png │ ├── ex04_lti_wts.html │ ├── ex04_lti_wts.png │ ├── ex04_lti_wts_01.png │ ├── ex04_lti_wts_02.png │ ├── ex04_lti_wts_03.png │ ├── ex04_lti_wts_04.png │ ├── ex04_lti_wts_05.png │ ├── ex04_lti_wts_06.png │ ├── ex04_lti_wts_07.png │ ├── ex04_lti_wts_08.png │ ├── ex04_lti_wts_09.png │ ├── ex05_lti_wts_batch.html │ ├── ex05_lti_wts_batch.png │ ├── ex05_lti_wts_batch_01.png │ ├── ex05_lti_wts_batch_02.png │ ├── ex05_lti_wts_batch_03.png │ ├── ex05_lti_wts_batch_04.png │ ├── ex05_lti_wts_batch_05.png │ ├── ex05_lti_wts_batch_06.png │ ├── ex05_lti_wts_batch_07.png │ ├── ex06_lti_four_unc.html │ ├── ex06_lti_four_unc.png │ ├── ex06_lti_four_unc_01.png │ ├── ex06_lti_four_unc_02.png │ ├── ex06_lti_four_unc_03.png │ ├── ex06_lti_four_unc_04.png │ ├── ex06_lti_four_unc_05.png │ ├── ex06_lti_wts_unc.html │ ├── ex07_lti_wts_mcs.html │ ├── ex07_lti_wts_mcs.png │ ├── ex07_lti_wts_mcs_01.png │ ├── ex07_lti_wts_mcs_02.png │ ├── ex08_lti_wts_bootstrap.html │ ├── ex08_lti_wts_bootstrap.png │ ├── ex08_lti_wts_bootstrap_01.png │ ├── ex08_lti_wts_bootstrap_02.png │ ├── ex09_lti_plus_periodic_rotor.html │ ├── ex09_lti_plus_periodic_rotor.png │ ├── ex09_lti_plus_periodic_rotor_01.png │ ├── ex09_lti_plus_periodic_rotor_02.png │ ├── ex09_lti_plus_periodic_rotor_03.png │ ├── ex09_lti_plus_periodic_rotor_04.png │ ├── ex10_rlti_fast.html │ ├── ex10_rlti_fast.png │ ├── ex10_rlti_fast_01.png │ ├── ex11_rlti_slow.html │ ├── ex11_rlti_slow.png │ ├── ex11_rlti_slow_01.png │ ├── ex12_rlti_fast_closed.html │ ├── ex12_rlti_fast_closed.png │ ├── ex12_rlti_fast_closed_01.png │ ├── ex13_rlti_slow_closed.html │ ├── ex13_rlti_slow_closed.png │ ├── ex13_rlti_slow_closed_01.png │ ├── ex14_hamm_four.html │ ├── ex14_hamm_four.png │ ├── ex14_hamm_four_01.png │ ├── ex14_hamm_four_02.png │ ├── ex14_hamm_four_03.png │ ├── ex14_hamm_four_04.png │ ├── ex15_wiener_four.html │ ├── ex15_wiener_four.png │ ├── ex15_wiener_four_01.png │ ├── ex15_wiener_four_02.png │ ├── ex15_wiener_four_03.png │ ├── ex15_wiener_four_04.png │ ├── ex16_hammwiener_four.html │ ├── ex16_hammwiener_four.png │ ├── ex16_hammwiener_four_01.png │ ├── ex16_hammwiener_four_02.png │ ├── ex16_hammwiener_four_03.png │ └── ex16_hammwiener_four_04.png ├── smartrotor370.mat ├── smartrotor430.mat ├── temp ├── wtsLPV.m └── wtsLTI.m ├── extra ├── backwards │ ├── Juang, Linear System Identification via Backward-time observer models.pdf │ ├── dmodx.m │ ├── dordvarmax_back.m │ ├── dordvarx_back.m │ ├── dx2abc_back.m │ ├── dx2abcd_back.m │ ├── dx2abcdk_back.m │ ├── dx2abck_back.m │ ├── ex_lti_duct.m │ ├── ex_lti_duct_varmax.m │ ├── ex_lti_four.m │ ├── ex_lti_four_varmax.m │ ├── html │ │ ├── Thumbs.db │ │ ├── ex_lti_duct.html │ │ ├── ex_lti_duct.png │ │ ├── ex_lti_duct_01.png │ │ ├── ex_lti_duct_02.png │ │ ├── ex_lti_duct_03.png │ │ ├── ex_lti_duct_04.png │ │ ├── ex_lti_duct_05.png │ │ ├── ex_lti_duct_06.png │ │ ├── ex_lti_duct_varmax.html │ │ ├── ex_lti_duct_varmax.png │ │ ├── ex_lti_duct_varmax_01.png │ │ ├── ex_lti_duct_varmax_02.png │ │ ├── ex_lti_duct_varmax_03.png │ │ ├── ex_lti_duct_varmax_04.png │ │ ├── ex_lti_duct_varmax_05.png │ │ ├── ex_lti_duct_varmax_06.png │ │ ├── ex_lti_four.html │ │ ├── ex_lti_four.png │ │ ├── ex_lti_four_01.png │ │ ├── ex_lti_four_02.png │ │ ├── ex_lti_four_03.png │ │ ├── ex_lti_four_04.png │ │ ├── ex_lti_four_05.png │ │ ├── ex_lti_four_06.png │ │ ├── ex_lti_four_07.png │ │ ├── ex_lti_four_08.png │ │ ├── ex_lti_four_varmax.html │ │ ├── ex_lti_four_varmax.png │ │ ├── ex_lti_four_varmax_01.png │ │ ├── ex_lti_four_varmax_02.png │ │ ├── ex_lti_four_varmax_03.png │ │ ├── ex_lti_four_varmax_04.png │ │ ├── ex_lti_four_varmax_05.png │ │ ├── ex_lti_four_varmax_06.png │ │ ├── ex_lti_four_varmax_07.png │ │ └── ex_lti_four_varmax_08.png │ └── private │ │ ├── exls_back.m │ │ ├── kernmatrix.m │ │ ├── kernregress.m │ │ ├── reggcv.m │ │ ├── reglcurve.m │ │ └── regress.m └── greybox │ ├── Reynders SYSID.pdf │ ├── dmodx_grey.m │ ├── dordvarx_grey.m │ ├── ex_lti_four_greybox.m │ ├── ex_lti_wts_greybox.m │ ├── html │ ├── Thumbs.db │ ├── ex_lti_four_greybox.html │ ├── ex_lti_four_greybox.png │ ├── ex_lti_four_greybox_01.png │ ├── ex_lti_four_greybox_02.png │ ├── ex_lti_four_greybox_03.png │ ├── ex_lti_four_greybox_04.png │ ├── ex_lti_four_greybox_05.png │ ├── ex_lti_four_greybox_06.png │ ├── ex_lti_four_greybox_07.png │ ├── ex_lti_four_greybox_08.png │ ├── ex_lti_wts_greybox.html │ ├── ex_lti_wts_greybox.png │ ├── ex_lti_wts_greybox_01.png │ ├── ex_lti_wts_greybox_02.png │ ├── ex_lti_wts_greybox_03.png │ ├── ex_lti_wts_greybox_04.png │ ├── ex_lti_wts_greybox_05.png │ ├── ex_lti_wts_greybox_06.png │ ├── ex_lti_wts_greybox_07.png │ ├── ex_lti_wts_greybox_08.png │ ├── ex_lti_wts_greybox_09.png │ ├── ex_lti_wts_greybox_10.png │ └── ex_lti_wts_greybox_11.png │ ├── private │ ├── reggcv.m │ ├── reglcurve.m │ └── regress.m │ └── wtsLTI.m ├── fit.m ├── helpindex.xml ├── helptoc.xml ├── hmodx.m ├── hordvarx.m ├── hwmodx.m ├── hwordvarx.m ├── hwx2abcdk.m ├── hwx2abck.m ├── hx2abcdk.m ├── hx2abck.m ├── idmultisine.m ├── idprbs.m ├── idss2idafflpvA.m ├── info.xml ├── lmodx.m ├── lobshinfsyn.m ├── lordvarx.m ├── lordvarxydist.m ├── lpv2ltv.m ├── lx2abcdk.m ├── lx2abcdkydist.m ├── lx2abck.m ├── pbsid_product_page.html ├── pbsidsetup.m ├── pec.m ├── plpv2ltv.m ├── pmodx.m ├── pordvarx.m ├── private ├── NormGroupL2_dual.m ├── NormGroupL2_primal.m ├── NormGroupL2_project.m ├── NormL12_dual.m ├── NormL12_primal.m ├── NormL12_project.m ├── NormL1_dual.m ├── NormL1_primal.m ├── NormL1_project.m ├── allcomb.m ├── dpkalm.m ├── dplqr.m ├── dpre.m ├── dpreb.m ├── ellipsebnd.m ├── ensure.m ├── exls.m ├── hline.m ├── jacobianest.m ├── kernmatrix.m ├── kernregress.m ├── kfcv.m ├── khatrirao.m ├── kpinv.m ├── logx.m ├── lsqr.m ├── nuclear.m ├── oneProjector.m ├── oneProjectorMex.m ├── oneProjectorMex.mexw64 ├── patchplot.m ├── rcca.m ├── reggcv.m ├── reglcurve.m ├── regress.m ├── spgSetParms.m ├── spg_bp.m ├── spg_bpdn.m ├── spg_group.m ├── spg_lasso.m ├── spg_mmv.m ├── spg_mmv_stopvali.m ├── spgl1.m ├── spgl1_stopvali.m ├── spgl1oneProjector │ ├── heap.c │ ├── heap.h │ ├── oneProjectorCore.c │ ├── oneProjectorCore.h │ └── oneProjectorMex.c └── vline.m ├── pschedclust.m ├── px2abcdk.m ├── px2abck.m ├── rpbsid.m ├── searchq.m ├── sigscale.m ├── simulink ├── GUST2data.mat ├── GUST2weight_f10.mat ├── GUST2weight_f5.mat ├── GUST2weight_f50.mat ├── RPBSIDblocks.mdl ├── sfun_rttime.c ├── sfun_rttime.mexw64 ├── sfun_xygraph.m ├── sim1_rlti_varmax_fast_gust2.mdl ├── sim1_rlti_varmax_gust2.mdl ├── sim1_rlti_varmax_sqrt_gust2.mdl ├── sim1_rlti_varx_fast_gust2.mdl ├── sim1_rlti_varx_gust2.mdl ├── sim1_rlti_varx_sqrt_gust2.mdl ├── slprj │ └── _sfprj │ │ ├── sim1_rlti_varmax_gust2 │ │ └── _self │ │ │ └── sfun │ │ │ ├── info │ │ │ ├── binfo.mat │ │ │ └── chart5_YAcMENJsgW1dTHFHNLCtkC.mat │ │ │ └── src │ │ │ ├── c5_sim1_rlti_varmax_gust2.c │ │ │ ├── c5_sim1_rlti_varmax_gust2.h │ │ │ ├── c5_sim1_rlti_varmax_gust2.obj │ │ │ ├── mexopts.bat │ │ │ ├── rtwtypes.h │ │ │ ├── rtwtypeschksum.mat │ │ │ ├── sim1_rlti_varmax_gust2_sfun.bat │ │ │ ├── sim1_rlti_varmax_gust2_sfun.c │ │ │ ├── sim1_rlti_varmax_gust2_sfun.exp │ │ │ ├── sim1_rlti_varmax_gust2_sfun.h │ │ │ ├── sim1_rlti_varmax_gust2_sfun.lib │ │ │ ├── sim1_rlti_varmax_gust2_sfun.mak │ │ │ ├── sim1_rlti_varmax_gust2_sfun.map │ │ │ ├── sim1_rlti_varmax_gust2_sfun.mexw64.manifest │ │ │ ├── sim1_rlti_varmax_gust2_sfun.mol │ │ │ ├── sim1_rlti_varmax_gust2_sfun.obj │ │ │ ├── sim1_rlti_varmax_gust2_sfun_debug_macros.h │ │ │ ├── sim1_rlti_varmax_gust2_sfun_registry.c │ │ │ └── sim1_rlti_varmax_gust2_sfun_registry.obj │ │ ├── sim1_rlti_varx_fast_gust2 │ │ └── _self │ │ │ └── sfun │ │ │ ├── info │ │ │ ├── binfo.mat │ │ │ ├── chart1_RldjQTVqZeaf7bPKMIG6FG.mat │ │ │ └── chart1_v2EDslKQ9w9YLzGIbb0pOB.mat │ │ │ └── src │ │ │ ├── c1_sim1_rlti_varx_fast_gust2.c │ │ │ ├── c1_sim1_rlti_varx_fast_gust2.h │ │ │ ├── c1_sim1_rlti_varx_fast_gust2.obj │ │ │ ├── mexopts.bat │ │ │ ├── rtwtypes.h │ │ │ ├── rtwtypeschksum.mat │ │ │ ├── sim1_rlti_varx_fast_gust2_sfun.bat │ │ │ ├── sim1_rlti_varx_fast_gust2_sfun.c │ │ │ ├── sim1_rlti_varx_fast_gust2_sfun.exp │ │ │ ├── sim1_rlti_varx_fast_gust2_sfun.h │ │ │ ├── sim1_rlti_varx_fast_gust2_sfun.lib │ │ │ ├── sim1_rlti_varx_fast_gust2_sfun.mak │ │ │ ├── sim1_rlti_varx_fast_gust2_sfun.map │ │ │ ├── sim1_rlti_varx_fast_gust2_sfun.mexw64.manifest │ │ │ ├── sim1_rlti_varx_fast_gust2_sfun.mol │ │ │ ├── sim1_rlti_varx_fast_gust2_sfun.obj │ │ │ ├── sim1_rlti_varx_fast_gust2_sfun_debug_macros.h │ │ │ ├── sim1_rlti_varx_fast_gust2_sfun_registry.c │ │ │ └── sim1_rlti_varx_fast_gust2_sfun_registry.obj │ │ └── sim1_rlti_varx_gust2 │ │ └── _self │ │ └── sfun │ │ ├── info │ │ ├── binfo.mat │ │ ├── chart2_ABX9sv2Fuqtg24DYMjDvvF.mat │ │ └── chart2_sqMHCYEULCklBR6f1VisPC.mat │ │ └── src │ │ ├── c2_sim1_rlti_varx_gust2.c │ │ ├── c2_sim1_rlti_varx_gust2.h │ │ ├── c2_sim1_rlti_varx_gust2.obj │ │ ├── mexopts.bat │ │ ├── rtwtypes.h │ │ ├── rtwtypeschksum.mat │ │ ├── sim1_rlti_varx_gust2_sfun.bat │ │ ├── sim1_rlti_varx_gust2_sfun.c │ │ ├── sim1_rlti_varx_gust2_sfun.exp │ │ ├── sim1_rlti_varx_gust2_sfun.h │ │ ├── sim1_rlti_varx_gust2_sfun.lib │ │ ├── sim1_rlti_varx_gust2_sfun.mak │ │ ├── sim1_rlti_varx_gust2_sfun.map │ │ ├── sim1_rlti_varx_gust2_sfun.mexw64.manifest │ │ ├── sim1_rlti_varx_gust2_sfun.mol │ │ ├── sim1_rlti_varx_gust2_sfun.obj │ │ ├── sim1_rlti_varx_gust2_sfun_debug_macros.h │ │ ├── sim1_rlti_varx_gust2_sfun_registry.c │ │ └── sim1_rlti_varx_gust2_sfun_registry.obj ├── xpc1_h2_ctrl.m └── xpc1_rlti_varx_sqrt.mdl ├── snr.m ├── spaavf.m ├── vaf.m ├── wmodx.m ├── wordvarx.m ├── wx2abcdk.m └── wx2abck.m /@idafflpv/c2d.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/@idafflpv/c2d.m -------------------------------------------------------------------------------- /@idafflpv/d2c.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/@idafflpv/d2c.m -------------------------------------------------------------------------------- /@idafflpv/idafflpv2idss.m: -------------------------------------------------------------------------------- 1 | function [sys] = idafflpv2idss(sys,p) 2 | %IDAFFLPV/IDAFFLPV2IDSS Convert IDAFFLPV model to multiple IDSS models. 3 | % [M] = IDAFFLPV2IDSS(M,MU) converts IDAFFLPV model M to multiple IDSS 4 | % models for every time step in the scheduling vector MU. 5 | 6 | % determine lpv system sizes 7 | [l,r,n,m] = size(sys); 8 | N = size(p,1); 9 | 10 | % get system matrices 11 | [Alpv,Blpv,Clpv,Dlpv,Klpv] = getABCDK(sys); 12 | Ts = sys.Ts; 13 | Name = sys.Name; 14 | X0 = sys.x0; 15 | lambda = sys.NoiseVariance; 16 | InputName = sys.InputName; 17 | OutputName = sys.OutputName; 18 | StateName = sys.StateName; 19 | 20 | % allocate cells 21 | A = zeros(n,n,N); 22 | B = zeros(n,r,N); 23 | C = zeros(l,n,N); 24 | D = zeros(l,r,N); 25 | K = zeros(n,l,N); 26 | 27 | % construct ss models 28 | for i = 1:N 29 | A(:,:,i) = Alpv(1:n,1:n); 30 | B(:,:,i) = Blpv(1:n,1:r); 31 | C(:,:,i) = Clpv(1:l,1:n); 32 | D(:,:,i) = Dlpv(1:l,1:r); 33 | K(:,:,i) = Klpv(1:n,1:l); 34 | for j = 1:m 35 | A(:,:,i) = A(:,:,i) + Alpv(1:n,(j-1)*n+1+n:j*n+n).*p(i,j); 36 | B(:,:,i) = B(:,:,i) + Blpv(1:n,(j-1)*r+1+r:j*r+r).*p(i,j); 37 | C(:,:,i) = C(:,:,i) + Clpv(1:l,(j-1)*n+1+n:j*n+n).*p(i,j); 38 | D(:,:,i) = D(:,:,i) + Dlpv(1:l,(j-1)*r+1+r:j*r+r).*p(i,j); 39 | K(:,:,i) = K(:,:,i) + Klpv(1:n,(j-1)*l+1+l:j*l+l).*p(i,j); 40 | end 41 | end 42 | sys = idss(A,B,C,D,K,X0,Ts,'Name',Name,'InputName',InputName,'OutputName',OutputName,'StateName',StateName); 43 | sys.x0 = X0; 44 | sys = pvset(sys,'NoiseVariance',lambda); -------------------------------------------------------------------------------- /@idafflpv/idafflpv2ss.m: -------------------------------------------------------------------------------- 1 | function [sys] = idafflpv2ss(sys,p) 2 | %IDAFFLPV/IDAFFLPV2SS Convert affine LPV model to multiple LTI SS models. 3 | % [M] = IDAFFLPV2SS(M,MU) converts IDAFFLPV model M to multiple SS 4 | % models for every time step in the scheduling vector MU. 5 | 6 | % determine lpv system sizes 7 | [l,r,n,m] = size(sys); 8 | N = size(p,1); 9 | 10 | % get system matrices 11 | [Alpv,Blpv,Clpv,Dlpv,Klpv] = getABCDK(sys); 12 | Ts = sys.Ts; 13 | Name = sys.Name; 14 | InputName = sys.InputName; 15 | OutputName = sys.OutputName; 16 | for i = 1:l 17 | InputName = [InputName; 'Innovation']; 18 | end 19 | StateName = sys.StateName; 20 | L = chol(sys.NoiseVariance,'lower'); 21 | 22 | % allocate cells 23 | A = zeros(n,n,N); 24 | B = zeros(n,r+l,N); 25 | C = zeros(l,n,N); 26 | D = zeros(l,r+l,N); 27 | 28 | % construct ss models 29 | for i = 1:N 30 | A(:,:,i) = Alpv(1:n,1:n); 31 | B(:,:,i) = [Blpv(1:n,1:r) Klpv(1:n,1:l)*L]; 32 | C(:,:,i) = Clpv(1:l,1:n); 33 | D(:,:,i) = [Dlpv(1:l,1:r) eye(l,l)*L]; 34 | for j = 1:m 35 | A(:,:,i) = A(:,:,i) + Alpv(1:n,(j-1)*n+1+n:j*n+n).*p(i,j); 36 | B(:,:,i) = B(:,:,i) + [Blpv(1:n,(j-1)*r+1+r:j*r+r) Klpv(1:n,(j-1)*l+1+l:j*l+l)*L].*p(i,j); 37 | C(:,:,i) = C(:,:,i) + Clpv(1:l,(j-1)*n+1+n:j*n+n).*p(i,j); 38 | D(:,:,i) = D(:,:,i) + [Dlpv(1:l,(j-1)*r+1+r:j*r+r) zeros(l)].*p(i,j); 39 | end 40 | end 41 | warning off; 42 | sys = ss(A,B,C,D,Ts,'Name',Name,'InputName',InputName,'OutputName',OutputName,'StateName',StateName); 43 | warning on; -------------------------------------------------------------------------------- /@idafflpv/idafflpvA2idss.m: -------------------------------------------------------------------------------- 1 | function [sys,u,y] = idafflpvA2idss(sys,u,y,mu) 2 | %IDAFFLPV/IDAFFLPVA2IDSS Convert IDAFFLPV (constant A) model to single IDSS model. 3 | % [M] = IDAFFLPVA2IDSS(M) converts IDAFFLPV model M (with constant A) to 4 | % single IDSS models. Usefull for discretization of LPV models with 5 | % constant A. 6 | 7 | % determine lpv system sizes 8 | [l,r,n,m] = size(sys); 9 | 10 | % get system matrices 11 | [Alpv,Blpv,Clpv,Dlpv,Klpv] = getABCDK(sys); 12 | Ts = sys.Ts; 13 | Name = sys.Name; 14 | X0 = sys.x0; 15 | lambda = sys.NoiseVariance; 16 | InputName = sys.InputName; 17 | OutputName = sys.OutputName; 18 | StateName = {sys.StateName{1:n}}; 19 | 20 | % allocate cells 21 | A = Alpv(1:n,1:n); 22 | B = Blpv; 23 | C = zeros(l*(m+1),n); 24 | D = zeros(l*(m+1),r*(m+1)); 25 | K = Klpv; 26 | 27 | % construct ss models 28 | for j = 1:(m+1) 29 | C((j-1)*l+1:j*l,:) = Clpv(:,(j-1)*n+1:j*n); 30 | D((j-1)*l+1:j*l,(j-1)*r+1:j*r) = Dlpv(:,(j-1)*r+1:j*r); 31 | end 32 | sys = idss(A,B,C,D,K,X0,Ts,'Name',Name,'InputName',InputName,'OutputName',OutputName,'StateName',StateName); 33 | sys.x0 = X0; 34 | lambda = kron(eye(m+1),lambda); 35 | sys = pvset(sys,'NoiseVariance',lambda); 36 | 37 | 38 | if nargin > 1 39 | if size(u,2) < size(u,1) 40 | u = u'; 41 | end 42 | if size(y,2) < size(y,1) 43 | y = y'; 44 | end 45 | if size(mu,2) < size(mu,1) 46 | mu = mu'; 47 | end 48 | mu = [ones(1,size(mu,2)); mu]; 49 | u = khatrirao(mu,u)'; 50 | y = khatrirao(mu,y)'; 51 | end -------------------------------------------------------------------------------- /@idafflpv/iosize.m: -------------------------------------------------------------------------------- 1 | function [ny,nu] = iosize(sys) 2 | %IDAFFLPV/IOSIZE Returns I/O size of dynamical systems. 3 | % [NY,NU] = IOSIZE(SYS) 4 | % S = IOSIZE(SYS) returns S = [NY NU]. 5 | 6 | [ny,nu] = size(sys); 7 | if nargout==1 8 | ny = [ny nu]; 9 | end 10 | -------------------------------------------------------------------------------- /@idafflpv/isct.m: -------------------------------------------------------------------------------- 1 | function boo = isct(sys) 2 | %IDAFFLPV/ISCT True for continuous-time IDAFFLPV models. 3 | 4 | % SYS is continuous if Ts = 0 5 | boo = isempty(sys.Ts) || sys.Ts==0; 6 | -------------------------------------------------------------------------------- /@idafflpv/isdt.m: -------------------------------------------------------------------------------- 1 | function boo = isdt(sys) 2 | %IDAFFLPV/ISDT True for discrete-time IDAFFLPV models. 3 | 4 | % SYS is discrete if Ts ~= 0 5 | boo = (isempty(sys.Ts) || sys.Ts~=0 || isstatic(sys)); 6 | -------------------------------------------------------------------------------- /@idafflpv/isempty.m: -------------------------------------------------------------------------------- 1 | function boo = isempty(sys) 2 | %IDAFFLPV/ISEMPTY True for empty IDAFFLPV models. 3 | 4 | boo = any(size(sys)==0); 5 | 6 | -------------------------------------------------------------------------------- /@idafflpv/issiso.m: -------------------------------------------------------------------------------- 1 | function boo = issiso(sys) 2 | %IDAFFLPV/ISSISO True for SISO IDAFFLPV models. 3 | 4 | sizes = size(sys); 5 | boo = all(sizes(1:2) == 1); 6 | 7 | -------------------------------------------------------------------------------- /@idafflpv/isstatic.m: -------------------------------------------------------------------------------- 1 | function boo = isstatic(sys) 2 | %IDAFFLPV/ISSTATIC Returns TRUE if model is a pure gain. 3 | 4 | boo = isempty(sys.a); 5 | -------------------------------------------------------------------------------- /@idafflpv/order.m: -------------------------------------------------------------------------------- 1 | function nx = order(D) 2 | %IDAFFLPV/ORDER Computes order of IDAFFLPV models 3 | 4 | nx = size(D.a,1); 5 | -------------------------------------------------------------------------------- /@idafflpv/pe.m: -------------------------------------------------------------------------------- 1 | function [e,x0] = pe(sys,u,y,t,p,type) 2 | %PE Computes the prediction errors of an IDAFFLPV. 3 | % [E,X0] = PE(M,U,Y,T,MU) returns the residue response and initial state 4 | % of the IDAFFLPV model M to the input and scheduling signal described by 5 | % U, Y, MU and T. The time vector T consists of regularly spaced time 6 | % samples, U, Y, and MU is are matrices with as many columns as inputs and 7 | % scheduling variables and whose i-th row specifies the input value at 8 | % time T(i). For discrete-time models, U, Y, and MU should be sampled at 9 | % the same rate as M. 10 | % 11 | % [E,X0] = PE(M,U,Y,T,MU,'Type') specifies the type of LPV predictor. 'K' 12 | % specifies that K is not dependent on scheduling, or 'CD' specifies 13 | % that C and D is not dependent on scheduling. Default is Type = 'CD'. 14 | % 15 | % NOTE: This is only possible if K or C and D are not dependent on the 16 | % scheduling sequence. 17 | 18 | % Assign values to unspecified parameters 19 | if nargin < 6 || isempty(type) 20 | type = 'CD'; 21 | end 22 | x0 = findstates(sys,u,y,t,p,type); 23 | e = resid(sys,u,y,t,p,x0,type); 24 | end 25 | -------------------------------------------------------------------------------- /@idafflpv/predictor.m: -------------------------------------------------------------------------------- 1 | function P = predictor(M,type) 2 | %PREDICTOR returns the predictor form of the LPV model M 3 | 4 | % [E,X0] = PE(M,U,Y,T,MU,'Type') specifies the type of LPV predictor. 'K' 5 | % specifies that K is not dependent on scheduling, or 'CD' specifies 6 | % that C and D is not dependent on scheduling. Default is Type = 'CD'. 7 | 8 | [A,B,C,D,K] = getABCDK(M); 9 | [Ny,Nu,Nx,Np] = size(M); 10 | 11 | if strcmpi(type,'CD') 12 | for i = 1:Np+1 13 | A(:,(i-1)*Nx+1:i*Nx) = A(:,(i-1)*Nx+1:i*Nx) - K(:,(i-1)*Ny+1:i*Ny)*C(:,1:Nx); 14 | B(:,(i-1)*Nu+1:i*Nu) = B(:,(i-1)*Nu+1:i*Nu) - K(:,(i-1)*Ny+1:i*Ny)*D(:,1:Nu); 15 | end 16 | elseif strcmpi(type,'K') 17 | for i = 1:Np+1 18 | A(:,(i-1)*Nx+1:i*Nx) = A(:,(i-1)*Nx+1:i*Nx) - K(:,1:Ny)*C(:,(i-1)*Nx+1:i*Nx); 19 | B(:,(i-1)*Nu+1:i*Nu) = B(:,(i-1)*Nu+1:i*Nu) - K(:,1:Ny)*D(:,(i-1)*Nu+1:i*Nu); 20 | end 21 | else 22 | error('Type not recognized!') 23 | end 24 | 25 | P = idafflpv(A,B,C,D,K,M.x0,M.Ts); 26 | 27 | end 28 | 29 | -------------------------------------------------------------------------------- /@idafflpv/private/allcomb.m: -------------------------------------------------------------------------------- 1 | function B = allcomb(A) 2 | %% all combinations of columns in A 3 | 4 | [ni,nm] = size(A); 5 | ii = ni:-1:1; 6 | A = mat2cell(A, ones(1,ni), nm); 7 | % flip using ii if last column is changing fastest 8 | [B{ii}] = ndgrid(A{ii}) ; 9 | % concatenate 10 | B = reshape(cat(ni+1,B{:}),[],ni)'; 11 | end -------------------------------------------------------------------------------- /@idafflpv/private/checkMatrixData.m: -------------------------------------------------------------------------------- 1 | function M = checkMatrixData(M,MatrixName) 2 | % Checks A,B,C,D,K,E data is of proper type 3 | 4 | if ~isnumeric(M) 5 | error('Invalid model: %s matrix must be a numeric array.',MatrixName) 6 | elseif MatrixName~='D' && ~all(isfinite(M(:))) 7 | error('Invalid model: %s matrix contains Inf or NaN.',MatrixName) 8 | else 9 | % Convert to full double 10 | if issparse(M) 11 | warning('Sparse matrix %s converted to full.',MatrixName) 12 | M = full(M); 13 | end 14 | M = double(M); 15 | end 16 | -------------------------------------------------------------------------------- /@idafflpv/private/checkMatrixDims.m: -------------------------------------------------------------------------------- 1 | function [Ns,Ny,Nu,Np] = checkMatrixDims(a,b,c,d,k,x0) 2 | % Determines and checks the system matrix sizes. 3 | 4 | % Check sizes 5 | if size(a,2) ~= size(c,2) 6 | error('Number of columns of A and C must be equal.'); 7 | end 8 | if size(a,1) ~= size(b,1) 9 | error('Number of rows of A and B must be equal.'); 10 | end 11 | if size(a,1) ~= size(k,1) 12 | error('Number of rows of A and K must be equal.'); 13 | end 14 | if size(a,1) ~= size(x0,1) 15 | error('Number of rows of A and x0 must be equal.'); 16 | end 17 | if size(b,2) ~= size(d,2) 18 | error('Number of columns of B and D must be equal.'); 19 | end 20 | if size(c,1) ~= size(d,1) 21 | error('Number of rows of C and D must be equal.'); 22 | end 23 | 24 | % Number of states 25 | Ns = size(a,1); 26 | 27 | % Determine number scheduling parameters 28 | Np = size(a,2)/Ns; 29 | 30 | % Number of inputs 31 | Nu = size(b,2)/Np; 32 | 33 | % Number of outputs 34 | Ny = size(c,1); 35 | 36 | Np = Np - 1; 37 | 38 | -------------------------------------------------------------------------------- /@idafflpv/private/getABCD.m: -------------------------------------------------------------------------------- 1 | function [a,b,c,d] = getABCD(sys) 2 | % Returns explicit state matrices (a,b,c,d). 3 | 4 | a = sys.a; 5 | b = sys.b; 6 | c = sys.c; 7 | d = sys.d; 8 | 9 | -------------------------------------------------------------------------------- /@idafflpv/private/getABCDK.m: -------------------------------------------------------------------------------- 1 | function [a,b,c,d,k] = getABCDK(sys) 2 | % Returns explicit state matrices (a,b,c,d). 3 | 4 | a = sys.a; 5 | b = sys.b; 6 | c = sys.c; 7 | d = sys.d; 8 | k = sys.k; 9 | -------------------------------------------------------------------------------- /@idafflpv/private/khatrirao.m: -------------------------------------------------------------------------------- 1 | function P = khatrirao(varargin) 2 | %KHATRIRAO Khatri-Rao product of matrices. 3 | % KHATRIRAO(A,B) computes the Khatri-Rao product of matrices A and 4 | % B that have the same number of columns. The result is the 5 | % column-wise Kronecker product 6 | % [KRON(A(:,1),B(:,1)) ... KRON(A(:,n),B(:,n))] 7 | % 8 | % KHATRIRAO(A1,A2,...) computes the Khatri-Rao product of 9 | % multiple matrices that have the same number of columns. 10 | % 11 | % KHATRIRAO(C) computes the Khatri-Rao product of 12 | % the matrices in cell array C. 13 | % 14 | % KHATRIRAO(...,'r') computes the Khatri-Rao product in reverse 15 | % order. 16 | % 17 | % Examples 18 | % A = rand(5,2); B = rand(3,2); C = rand(2,2); 19 | % khatrirao(A,B) %<-- Khatri-Rao of A and B 20 | % khatrirao(B,A,'r') %<-- same thing as above 21 | % khatrirao({C,B,A}) %<-- passing a cell array 22 | % khatrirao({A,B,C},'r') %<-- same as above 23 | % 24 | % See also TENSOR, KTENSOR. 25 | 26 | % MATLAB Tensor Toolbox. 27 | % Copyright 2009, Sandia Corporation. 28 | 29 | %% Error checking on input and set matrix order 30 | % Note that this next if/else check forces A to be a cell array. 31 | if ischar(varargin{end}) && varargin{end} == 'r' 32 | if nargin == 2 && iscell(varargin{1}) 33 | % Input is a single cell array 34 | A = varargin{1}; 35 | else 36 | % Input is a sequence of matrices 37 | A = {varargin{1:end-1}}; 38 | end 39 | matorder = length(A):-1:1; 40 | else 41 | if nargin == 1 && iscell(varargin{1}) 42 | % Input is a single cell array 43 | A = varargin{1}; 44 | else 45 | % Input is a sequence of matrices 46 | A = varargin; 47 | end 48 | matorder = 1:length(A); 49 | end 50 | 51 | %% Error check on matrices and compute number of rows in result 52 | 53 | % N = number of columns (must be the same for every input) 54 | N = size(A{1},2); 55 | 56 | % After loop, M = number of rows in the result 57 | M = 1; 58 | 59 | for i = matorder 60 | if ndims(A) ~= 2 61 | error('Each argument must be a matrix'); 62 | end 63 | if (N ~= size(A{i},2)) 64 | error('All matrices must have the same number of columns.') 65 | end 66 | M = M * size(A{i},1); 67 | end 68 | 69 | %% Computation 70 | 71 | % Preallocate 72 | P = zeros(M,N); 73 | 74 | % Loop through all the columns 75 | for n = 1:N 76 | % Loop through all the matrices 77 | ab = A{matorder(1)}(:,n); 78 | for i = matorder(2:end) 79 | % Compute outer product of nth columns 80 | ab = A{i}(:,n) * ab(:).'; 81 | end 82 | % Fill nth column of P with reshaped result 83 | P(:,n) = ab(:); 84 | end 85 | 86 | -------------------------------------------------------------------------------- /@idafflpv/private/lpv2par.m: -------------------------------------------------------------------------------- 1 | function [th,d]=lpv2par(A,B,C,D) 2 | %LPV2PAR Convert LPV system matrices to parameter vector. 3 | % lpv2par converts the system matrices A, B, C, D of 4 | % the following LPV system to a parameter vector to 5 | % be used with lpvopt: 6 | % 7 | % x(k+1) = A(:,1:n)*x(k) + A(:,n+1:n*(q+1))*kron(p(k),x(k)) 8 | % + B(:,1:m)*u(k) + B(:,m+1:m*(q+1))*kron(p(k),u(k)) 9 | % y(k) = C(:,1:n)*x(k) + C(:,n+1:n*(q+1))*kron(p(k),x(k)) 10 | % + D(:,1:m)*u(k) + D(:,m+1:m*(q+1))*kron(p(k),u(k)) 11 | % 12 | % Syntax: 13 | % [th,dim] = lpv2par(A,B,C,D) 14 | % 15 | % Input: 16 | % A,B,C,D System matrices of the LPV state equation 17 | % with A: n x n(q+1), B: n x m(q+1), 18 | % C: l x n(q+1), and D: l x m(q+1). 19 | % 20 | % Output: 21 | % th Parameter vector. 22 | % dim Dimension vector containing the dimensions of 23 | % x(k), u(k), y(k) and p(k). 24 | % 25 | % See also: lpv2par, lpvopt. 26 | 27 | % Written by Vincent Verdult, February 2001. 28 | 29 | n=size(A,1); 30 | sn=size(A,2); 31 | sm=size(B,2); 32 | l=size(C,1); 33 | 34 | if size(B,1)~=n 35 | error('A and B must have the same number of rows.') 36 | end 37 | if size(C,2)~=sn 38 | error('A and C must have the same number of columns.') 39 | end 40 | if size(D,2)~=sm 41 | error('B and D must have the same number of columns.') 42 | end 43 | if size(D,1)~=l 44 | error('C and D must have the same number of rows.') 45 | end 46 | s=sn/n-1; 47 | if s~=fix(s) 48 | error('A matrix is of wrong size.') 49 | end 50 | m=sm/(s+1); 51 | if m~=fix(m) 52 | error('B matrix is of wrong size.') 53 | end 54 | 55 | d=[n;m;l;s]; 56 | th=reshape([A B; C D],(n+l)*(sm+sn),1); 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /@idafflpv/private/lpvitr.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/@idafflpv/private/lpvitr.mexw64 -------------------------------------------------------------------------------- /@idafflpv/private/lpvsim.m: -------------------------------------------------------------------------------- 1 | function [y,x]=lpvsim(A,B,C,D,p,u,w,x0) 2 | %LPVSIM Simulate LPV system. 3 | % lpvsim computes the output y(k) for k=1,2,...,N 4 | % of the linear parameter varying (LPV) system: 5 | % 6 | % x(k+1) = A(:,1:n)*x(k) + A(:,n+1:n*(q+1))*kron(p(k),x(k)) 7 | % + B(:,1:m)*u(k) + B(:,m+1:m*(q+1))*kron(p(k),u(k)) + w(k) 8 | % y(k) = C(:,1:n)*x(k) + C(:,n+1:n*(q+1))*kron(p(k),x(k)) 9 | % + D(:,1:m)*u(k) + D(:,m+1:m*(q+1))*kron(p(k),u(k)) 10 | % 11 | % Syntax: 12 | % x = lpvsim(A,B,C,D,p,u,w,x0) 13 | % 14 | % Input: 15 | % A,B,C,D System matrices of the LPV state equation 16 | % with A: n x n(q+1), B: n x m(q+1), 17 | % C: l x n(q+1), and D: l x m(q+1). 18 | % p N x q matrix containing N data points of the q 19 | % time varying parameters, 20 | % u N x m matrix containing N data points of the m 21 | % inputs. 22 | % w N x n matrix containing N data points of the 23 | % process noise that has dimension n. 24 | % x0 column vector containing the initial state. 25 | % 26 | % Output: 27 | % y N x l matrix containing the computed outputs. 28 | % x N x n matrix containing the computed state. 29 | % 30 | % See also: lpvitr, bilitr. 31 | 32 | % Written by Vincent Verdult, February 2001. 33 | 34 | % check input arguments 35 | if nargin<7 36 | error('Not enough input arguments.') 37 | end 38 | 39 | n=size(A,1); 40 | l=size(C,1); 41 | ns=size(A,2); 42 | ms=size(B,2); 43 | N=size(p,1); 44 | 45 | if nargin<8 46 | x0=zeros(n,1); 47 | end 48 | if size(D,1)~=l 49 | error('C and D must have the same number of rows.') 50 | end 51 | if size(C,2)~=ns 52 | error('A and C must have the same number of columns.') 53 | end 54 | if size(D,2)~=ms 55 | error('B and D must have the same number of columns.') 56 | end 57 | % remaining checks will be dealt with in lpvitr 58 | 59 | x=lpvitr(A,B,p,u,w,x0); 60 | 61 | s=ns/n-1; 62 | m=ms/(s+1); 63 | pu=zeros(N,s*m); 64 | px=zeros(N,s*n); 65 | for i = 1:s 66 | pu(:,(i-1)*m+1:i*m) = u.*(p(:,i)*ones(1,m)); 67 | end 68 | for i = 1:s; 69 | px(:,(i-1)*n+1:i*n) = x.*(p(:,i)*ones(1,n)); 70 | end 71 | 72 | y=[x, px]*C'+[u, pu]*D'; 73 | 74 | 75 | -------------------------------------------------------------------------------- /@idafflpv/private/par2lpv.m: -------------------------------------------------------------------------------- 1 | function [A,B,C,D]=par2lpv(th,d) 2 | %PAR2LPV Convert parameter vector to LPV system matrices. 3 | % par2lpv converts a parameter vector to the 4 | % system matrices A, B, C, D of the following LPV system: 5 | % 6 | % x(k+1) = A(:,1:n)*x(k) + A(:,n+1:n*(q+1))*kron(p(k),x(k)) 7 | % + B(:,1:m)*u(k) + B(:,m+1:m*(q+1))*kron(p(k),u(k)) 8 | % y(k) = C(:,1:n)*x(k) + C(:,n+1:n*(q+1))*kron(p(k),x(k)) 9 | % + D(:,1:m)*u(k) + D(:,m+1:m*(q+1))*kron(p(k),u(k)) 10 | % 11 | % Syntax: 12 | % [A,B,C,D] = par2lpv(th,dim) 13 | % 14 | % Input: 15 | % th Parameter vector created by lpv2par. 16 | % dim Dimension vector created by lpv2par. 17 | % 18 | % Output: 19 | % A,B,C,D System matrices of the LPV state equation 20 | % with A: n x n(q+1), B: n x m(q+1), 21 | % C: l x n(q+1), and D: l x m(q+1). 22 | % 23 | % See also: lpv2par, lpvopt. 24 | % 25 | % Written by Vincent Verdult, February 2001. 26 | 27 | if size(th,2)>size(th,1) 28 | th=th'; 29 | end 30 | if size(d,2)>size(d,1) 31 | d=d'; 32 | end 33 | if size(th,2)~=1 34 | error('th must be a vector.') 35 | end 36 | if size(d,2)~=1 37 | error('dim must be a vector.') 38 | end 39 | 40 | n=d(1); 41 | m=d(2); 42 | l=d(3); 43 | s=d(4); 44 | 45 | if size(th,1)~=(n+l)*(n+m)*(s+1) 46 | error('th and dim are not compatible.') 47 | end 48 | 49 | temp=reshape(th,n+l,(n+m)*(s+1)); 50 | A=temp(1:n,1:n*(s+1)); 51 | B=temp(1:n,n*(s+1)+1:(n+m)*(s+1)); 52 | C=temp(n+1:n+l,1:n*(s+1)); 53 | D=temp(n+1:n+l,n*(s+1)+1:(n+m)*(s+1)); 54 | 55 | -------------------------------------------------------------------------------- /@idafflpv/size.m: -------------------------------------------------------------------------------- 1 | function [Ny,Nu,Ns,Np] = size(sys) 2 | %IDAFFLPV/SIZE Size of affine LPV state-space system 3 | 4 | % Number of states 5 | Ns = size(sys.a,1); 6 | 7 | % Determine number scheduling parameters 8 | Np = size(sys.a,2)/Ns; 9 | 10 | % Number of inputs 11 | Nu = size(sys.b,2)/Np; 12 | 13 | % Number of outputs 14 | Ny = size(sys.c,1); 15 | 16 | Np = Np - 1; -------------------------------------------------------------------------------- /@idafflpv/ssdata.m: -------------------------------------------------------------------------------- 1 | function [a,b,c,d,k,x0,Ts] = ssdata(sys) 2 | %IDAFFLPV/SSDATA Returns state-space matrices for IDAFFLPV models. 3 | % [A,B,C,D,K,x0,Ts] = SSDATA(SYS) returns the A,B,C,D matrices of the 4 | % state-space model SYS. If SYS is not a state-space model, 5 | % it is first converted to the state-space representation. 6 | 7 | if nargout < 4 8 | % Extract data 9 | [a,b,c,d] = getABCD(sys); 10 | else 11 | % Extract data 12 | [a,b,c,d,k] = getABCDK(sys); 13 | end 14 | 15 | % Sample time 16 | if nsys==0 17 | Ts = 0; 18 | else 19 | Ts = sys.Ts; 20 | end 21 | x0 = sys.x0; 22 | -------------------------------------------------------------------------------- /@idafflpv/subsasgn.m: -------------------------------------------------------------------------------- 1 | function S = subsasgn(S,subs,A) 2 | %IDAFFLPV/SUBSASGN Define index assignment for AFFLPV system 3 | 4 | sub = subs(1); 5 | type = sub.type; 6 | index = sub.subs; 7 | 8 | switch type 9 | case '.' 10 | switch lower(index) 11 | case 'a' 12 | S.a = A; 13 | case 'b' 14 | S.b = A; 15 | case 'c' 16 | S.c = A; 17 | case 'd' 18 | S.d = A; 19 | case 'k' 20 | S.k = A; 21 | case 'x0' 22 | S.x0 = A; 23 | case 'ts' 24 | S.Ts = A; 25 | case 'statename' 26 | S.StateName = A; 27 | case 'schedulingname' 28 | S.SchedulingName = A; 29 | case 'noisevariance' 30 | S.NoiseVariance = A; 31 | case 'inputname' 32 | S.InputName = A; 33 | case 'outputname' 34 | S.Outputname = A; 35 | case 'name' 36 | S.Name = A; 37 | otherwise 38 | error('Variable not known') 39 | end 40 | 41 | otherwise 42 | error('Invalid field name') 43 | end 44 | 45 | end 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PBSID-Toolbox 2 | System Identification toolbox 3 | 4 | This toolbox is developed by researchers of the DATA-DRIVEN control group (TU DELFT) 5 | -------------------------------------------------------------------------------- /abc2idss.m: -------------------------------------------------------------------------------- 1 | function inov = abc2idss(data,A,B,C) 2 | %ABC2IDSS Create IDSS model structure 3 | % M = ABC2IDSS(IDDATA,A,B,C) returnes as a model structure object 4 | % describing the discrete-time model: 5 | % 6 | % x[k+1] = A x[k] + B u[k]; x[0] = X0 7 | % y[k] = C x[k] + e[k] 8 | % 9 | % See also: IDSS. 10 | 11 | % get sizes 12 | n = size(A,1); 13 | r = size(B,2); 14 | l = size(C,1); 15 | D = zeros(l,r); 16 | 17 | % store state-space matrices in inovation system object 18 | if iscell(data.Ts) 19 | Ts = data.Ts{1}; 20 | else 21 | Ts = data.Ts; 22 | end 23 | inov = idss(A,B,C,D,zeros(l,r),zeros(n,1),Ts,'InputName',data.Inputname,... 24 | 'OutputName',data.Outputname,'DisturbanceModel','Zero',... 25 | 'InitialState','Auto','SSParameterization','Free'); 26 | 27 | % estimate the prediction error and initial state 28 | [e,x0] = pe(inov,data,'e'); 29 | inov.x0 = x0(:,1); 30 | lambda = reshape(covf(e,1),l,l); 31 | inov = pvset(inov,'NoiseVariance',lambda); 32 | 33 | % store information about estimation 34 | est = pvget(inov,'EstimationInfo'); 35 | if iscell(e.OutputData) 36 | N = 0; 37 | for i = 1:length(e.OutputData) 38 | N = N + length(data.InputData{i}); 39 | end 40 | else 41 | N = length(data.InputData); 42 | end 43 | est.DataLength = N; 44 | est.DataTs = data.Ts; 45 | est.LossFcn = det(lambda); 46 | npar = n^2 + n*r + n*l; 47 | est.FPE = det(lambda)*(1+2*npar/N); 48 | dn = data.Name; 49 | if isempty(dn) 50 | dn = inputname(1); 51 | end 52 | est.DataName = dn; 53 | est.DataDomain = 'Time'; 54 | est.Status = 'Estimated model (PBSIDopt)'; 55 | est.Method = 'PBSIDopt'; 56 | if ~isempty(wtxt) 57 | est.Warning = wtxt; 58 | end 59 | est.InitialState = 'Estimate'; 60 | inov = pvset(inov,'EstimationInfo',est); 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /abcd2idss.m: -------------------------------------------------------------------------------- 1 | function inov = abcd2idss(data,A,B,C,D) 2 | %ABCD2IDSS Create IDSS model structure 3 | % M = ABCD2IDSS(IDDATA,A,B,C,D) returnes as a model structure object 4 | % describing the discrete-time model: 5 | % 6 | % x[k+1] = A x[k] + B u[k]; x[0] = X0 7 | % y[k] = C x[k] + D u[k] + e[k] 8 | % 9 | % See also: IDSS. 10 | 11 | 12 | % get sizes 13 | n = size(A,1); 14 | r = size(B,2); 15 | l = size(C,1); 16 | if isempty(D) 17 | D = zeros(l,r); 18 | end 19 | 20 | % store state-space matrices in inovation system object 21 | if iscell(data.Ts) 22 | Ts = data.Ts{1}; 23 | else 24 | Ts = data.Ts; 25 | end 26 | inov = idss(A,B,C,D,zeros(l,r),zeros(n,1),Ts,'InputName',data.Inputname,... 27 | 'OutputName',data.Outputname,'DisturbanceModel','Zero',... 28 | 'InitialState','Auto','SSParameterization','Free'); 29 | 30 | % estimate the prediction error and initial state 31 | [e,x0] = pe(inov,data,'e'); 32 | inov.x0 = x0(:,1); 33 | lambda = reshape(covf(e,1),l,l); 34 | inov = pvset(inov,'NoiseVariance',lambda); 35 | 36 | % store information about estimation 37 | est = pvget(inov,'EstimationInfo'); 38 | if iscell(e.OutputData) 39 | N = 0; 40 | for i = 1:length(e.OutputData) 41 | N = N + length(data.InputData{i}); 42 | end 43 | else 44 | N = length(data.InputData); 45 | end 46 | est.DataLength = N; 47 | est.DataTs = data.Ts; 48 | est.LossFcn = det(lambda); 49 | npar = n^2 + n*r + n*l + l*n; 50 | est.FPE = det(lambda)*(1+2*npar/N); 51 | dn = data.Name; 52 | if isempty(dn) 53 | dn = inputname(1); 54 | end 55 | est.DataName = dn; 56 | est.DataDomain = 'Time'; 57 | est.Status = 'Estimated model (PBSIDopt)'; 58 | est.Method = 'PBSIDopt'; 59 | if ~isempty(wtxt) 60 | est.Warning = wtxt; 61 | end 62 | est.InitialState = 'Estimate'; 63 | inov = pvset(inov,'EstimationInfo',est); 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /abcdk2idss.m: -------------------------------------------------------------------------------- 1 | function inov = abcdk2idss(data,A,B,C,D,K) 2 | %ABCDK2IDSS Create IDSS model structure 3 | % M = ABCDK2IDSS(IDDATA,A,B,C,D,K) returnes as a model structure object 4 | % describing the discrete-time model: 5 | % 6 | % x[k+1] = A x[k] + B u[k] + K e[k] ; x[0] = X0 7 | % y[k] = C x[k] + D u[k] + e[k] 8 | % 9 | % See also: IDSS. 10 | 11 | % get sizes 12 | n = size(A,1); 13 | r = size(B,2); 14 | l = size(C,1); 15 | if isempty(D) 16 | D = zeros(l,r); 17 | end 18 | 19 | % store state-space matrices in inovation system object 20 | if iscell(data.Ts) 21 | Ts = data.Ts{1}; 22 | else 23 | Ts = data.Ts; 24 | end 25 | inov = idss(A,B,C,D,K,zeros(n,1),Ts,'InputName',data.Inputname,... 26 | 'OutputName',data.Outputname,'DisturbanceModel','Estimate',... 27 | 'InitialState','Auto','SSParameterization','Free'); 28 | 29 | 30 | % estimate the prediction error and initial state 31 | [e,x0] = pe(inov,data,'e'); 32 | inov.x0 = x0(:,1); 33 | lambda = reshape(covf(e,1),l,l); 34 | inov = pvset(inov,'NoiseVariance',lambda); 35 | 36 | % store information about estimation 37 | est = pvget(inov,'EstimationInfo'); 38 | if iscell(e.OutputData) 39 | N = 0; 40 | for i = 1:length(e.OutputData) 41 | N = N + length(data.InputData{i}); 42 | end 43 | else 44 | N = length(data.InputData); 45 | end 46 | est.DataLength = N; 47 | est.DataTs = data.Ts; 48 | est.LossFcn = det(lambda); 49 | npar = n^2 + n*r + n*l + r*l + l*n; 50 | est.FPE = det(lambda)*(1+2*npar/N); 51 | dn = data.Name; 52 | if isempty(dn) 53 | dn = inputname(1); 54 | end 55 | est.DataName = dn; 56 | est.DataDomain = 'Time'; 57 | est.Status = 'Estimated model (PBSIDopt)'; 58 | est.Method = 'PBSIDopt'; 59 | est.InitialState = 'Estimate'; 60 | inov = pvset(inov,'EstimationInfo',est); 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /abck2idss.m: -------------------------------------------------------------------------------- 1 | function inov = abck2idss(data,A,B,C,K) 2 | %ABCK2IDSS Create IDSS model structure 3 | % M = ABCK2IDSS(IDDATA,A,B,C,K) returnes as a model structure object 4 | % describing the discrete-time model: 5 | % 6 | % x[k+1] = A x[k] + B u[k] + K e[k] ; x[0] = X0 7 | % y[k] = C x[k] + e[k] 8 | % 9 | % See also: IDSS. 10 | 11 | % get sizes 12 | n = size(A,1); 13 | r = size(B,2); 14 | l = size(C,1); 15 | D = zeros(l,r); 16 | 17 | % store state-space matrices in inovation system object 18 | if iscell(data.Ts) 19 | Ts = data.Ts{1}; 20 | else 21 | Ts = data.Ts; 22 | end 23 | inov = idss(A,B,C,D,K,zeros(n,1),Ts,'InputName',data.Inputname,... 24 | 'OutputName',data.Outputname,'DisturbanceModel','Estimate',... 25 | 'InitialState','Auto','SSParameterization','Free'); 26 | 27 | % estimate the prediction error and initial state 28 | [e,x0] = pe(inov,data,'e'); 29 | inov.x0 = x0(:,1); 30 | lambda = reshape(covf(e,1),l,l); 31 | inov = pvset(inov,'NoiseVariance',lambda); 32 | 33 | % store information about estimation 34 | est = pvget(inov,'EstimationInfo'); 35 | if iscell(e.OutputData) 36 | N = 0; 37 | for i = 1:length(e.OutputData) 38 | N = N + length(data.InputData{i}); 39 | end 40 | else 41 | N = length(data.InputData); 42 | end 43 | est.DataLength = N; 44 | est.DataTs = data.Ts; 45 | est.LossFcn = det(lambda); 46 | npar = n^2 + n*r + n*l + l*n; 47 | est.FPE = det(lambda)*(1+2*npar/N); 48 | dn = data.Name; 49 | if isempty(dn) 50 | dn = inputname(1); 51 | end 52 | est.DataName = dn; 53 | est.DataDomain = 'Time'; 54 | est.Status = 'Estimated model (PBSIDopt)'; 55 | est.Method = 'PBSIDopt'; 56 | if ~isempty(wtxt) 57 | est.Warning = wtxt; 58 | end 59 | est.InitialState = 'Estimate'; 60 | inov = pvset(inov,'EstimationInfo',est); 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /cubici1.m: -------------------------------------------------------------------------------- 1 | function r=cubici1(fnew,fold,graddnew,graddold,stepsize) 2 | %CUBICI1 Cubicly interpolates 2 points and gradients to estimate minimum. 3 | % 4 | % This function uses cubic interpolation and the values of two 5 | % points and their gradients in order to estimate the minimum of a 6 | % a function along a line. 7 | 8 | % Copyright (c) 1990 by the MathWorks, Inc. 9 | % Andy Grace 7-9-90. 10 | 11 | if fnew==Inf, fnew=1/eps; end 12 | z=3*(fold-fnew)/stepsize+graddold+graddnew; 13 | w=real(sqrt(z*z-graddold*graddnew)); 14 | r=stepsize*((z+w-graddold)/(graddnew-graddold+2*w)); 15 | 16 | -------------------------------------------------------------------------------- /cubici2.m: -------------------------------------------------------------------------------- 1 | function [stepmin]=cubici2(graddold,matl,matx) 2 | %CUBICI2 Cubicly interpolates 3 points and 1 gradient. 3 | % 4 | % This function uses cubic interpolation and 5 | % the values of 3 points and one gradient. 6 | 7 | % Copyright (c) 1990 by the MathWorks, Inc. 8 | % Andy Grace 7-9-90. 9 | abd=[1/3*matx.^3, 0.5*matx.^2, ones(3,1)]\(matl-graddold*matx); 10 | root=real(sqrt(abd(2)^2-4*abd(1)*graddold)); 11 | x1=(-abd(2)+root)/(2*abd(1)); 12 | if 2*abd(1)*x1+abd(2)>0 13 | stepmin=x1; 14 | else 15 | stepmin=(-abd(2)-root)/(2*abd(1)); 16 | end 17 | if stepmin<0|isnan(stepmin)|stepmin==Inf , stepmin=abs(quadi(matx,matl));end 18 | if isnan(stepmin),stepmin=matx(2)/2; end 19 | 20 | % fbest=1/3*abd(1)*stepmin^3+0.5*abd(2)*stepmin^2+graddold*stepmin+matl(1); 21 | -------------------------------------------------------------------------------- /cubici3.m: -------------------------------------------------------------------------------- 1 | function [stepmin,fbest]=cubici3(fnew,fold,graddnew,graddold,stepsize) 2 | %CUBICI3 Cubicly interpolates 2 points and gradients to find step and min. 3 | % 4 | % This function uses cubic interpolation and the values of 5 | % two points and their gradients in order estimate the minimum of a 6 | % a function along a line. 7 | 8 | % Copyright (c) 1990 by the MathWorks, Inc. 9 | % Andy Grace 7-9-90. 10 | if fnew==Inf, fnew=1/eps; end 11 | amat=[1/3*stepsize^3 , 0.5*stepsize^2; stepsize^2 stepsize]; 12 | bmat=[fnew-graddold*stepsize-fold; graddnew-graddold]; 13 | abd=amat\bmat; 14 | root=real(sqrt(abd(2)^2-4*abd(1)*graddold)); 15 | x1=(-abd(2)+root)/(2*abd(1)); 16 | if 2*abd(1)*x1+abd(2)>0 17 | stepmin=x1; 18 | else 19 | stepmin=(-abd(2)-root)/(2*abd(1));; 20 | end 21 | if stepmin<0, stepmin=-stepmin; end 22 | fbest=1/3*abd(1)*stepmin^3+0.5*abd(2)*stepmin^2+graddold*stepmin+fold; 23 | -------------------------------------------------------------------------------- /dbode.m: -------------------------------------------------------------------------------- 1 | function dbode(frd,w,h) 2 | %DBODE Bode diagram 3 | % dbode(G,w,h) plots the bode diagram (magnitude and phase) using the 4 | % estimated frequency resonse given in G, the frequencies w, and sample 5 | % time h. 6 | 7 | % Ivo Houtzager 8 | % Delft Center of Systems and Control 9 | % Delft University of Technology 10 | % The Netherlands, 2010 11 | 12 | % frd = unwrap(frd); 13 | l = size(frd,1); 14 | r = size(frd,2); 15 | for i = 1:l 16 | for j = 1:r 17 | subplot(l*2,r,j+(i-1)*2*r); 18 | hold on; 19 | plot(w./(2*pi),mag2db(squeeze(abs(frd(i,j,:)))),'k','linewidth',2); 20 | vline((pi/h)/(2*pi),'k'); 21 | xlabel('Frequency (Hz)'); 22 | ylabel('Magnitude (dB)'); 23 | logx; 24 | box on; 25 | hold off; 26 | 27 | subplot(l*2,r,j+r+(i-1)*2*r); 28 | hold on; 29 | plot(w./(2*pi),unwrap(rad2deg(squeeze(angle(frd(i,j,:))))),'k','linewidth',2); 30 | vline((pi/h)/(2*pi),'k'); 31 | xlabel('Frequency (Hz)'); 32 | ylabel('Phase (degrees)'); 33 | logx; 34 | box on; 35 | hold off; 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /dbodemag.m: -------------------------------------------------------------------------------- 1 | function dbodemag(frd,w,h) 2 | %DBODEMAG Bode diagram (magnitude only) 3 | % dbodemag(G,w,h) plots the bode diagram (magnitude only) using the 4 | % estimated frequency response given in G, the frequencies w, and sample 5 | % time h. 6 | 7 | % Ivo Houtzager 8 | % Delft Center of Systems and Control 9 | % Delft University of Technology 10 | % The Netherlands, 2010 11 | 12 | l = size(frd,1); 13 | r = size(frd,2); 14 | for i = 1:l 15 | for j = 1:r 16 | subplot(l,r,j+(i-1)*r) 17 | hold on; 18 | plot(w./(2*pi),mag2db(squeeze(abs(frd(i,j,:))))','k','linewidth',2); 19 | vline((pi/h)/(2*pi),'k'); 20 | xlabel('Frequency (Hz)'); 21 | ylabel('Magnitude (dB)'); 22 | logx; 23 | box on; 24 | hold off; 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /dbodemagpatch.m: -------------------------------------------------------------------------------- 1 | function dbodemagpatch(G,G_min,G_max,w,h,G_real) 2 | %DBODEMAGPATCH Bode diagram with given error bounds (magnitude only) 3 | % dbodemagpatch(G,Gmin,Gmax,w,h) plots the bode diagram (magnitude only) 4 | % using the estimated frequency response given in G and the frequency 5 | % bounds given in Gmin and Gmax, the frequencies w, and sample time h. 6 | % 7 | % dbodemagpatch(G,Gmin,Gmax,w,h,Greal) includes the plot of the frequency 8 | % response given in Greal. 9 | 10 | % Ivo Houtzager 11 | % Delft Center of Systems and Control 12 | % Delft University of Technology 13 | % The Netherlands, 2010 14 | 15 | if nargin > 5 16 | if ~isequal(size(G,3),size(G_min,3),size(G_max,3),size(G_real,3),length(w)) 17 | error('Number of frequencies points should be the same!') 18 | end 19 | else 20 | if ~isequal(size(G,3),size(G_min,3),size(G_max,3),length(w)) 21 | error('Number of frequencies points should be the same!') 22 | end 23 | end 24 | 25 | l = size(G,1); 26 | r = size(G,2); 27 | for i = 1:l 28 | for j = 1:r 29 | subplot(l,r,j+(i-1)*r); 30 | hold on; 31 | patchplot(w./(2*pi),mag2db(squeeze(abs(G(i,j,:))))',mag2db(squeeze(abs(G_min(i,j,:))))',mag2db(squeeze(abs(G_max(i,j,:))))'); 32 | if nargin > 5 33 | plot(w./(2*pi),mag2db(squeeze(abs(G_real(i,j,:))))','k--'); 34 | end 35 | vline((pi/h)/(2*pi),'k'); 36 | xlabel('Frequency (Hz)'); 37 | ylabel('Magnitude (dB)'); 38 | logx; 39 | box on; 40 | hold off; 41 | end 42 | end 43 | end 44 | 45 | -------------------------------------------------------------------------------- /dbodemagsd.m: -------------------------------------------------------------------------------- 1 | function dbodemagsd(G,covG,sd,w,h,G_real) 2 | %DBODEMAGSD Bode diagram with probalistic error bounds (magnitude only) 3 | % dbodemagsd(G,cogG,sd,w,h) plots the bode diagram (magnitude only) 4 | % using the estimated frequency response given in G and the frequency 5 | % bounds given in covG and sd, the frequencies w, and sample time h. The 6 | % value sd is the standard deviation and is larger than zero. 7 | % 8 | % dbodemagsd(G,cogG,sd,w,h,Greal) includes the plot of the frequency 9 | % response given in Greal. 10 | 11 | if nargin > 5 12 | if ~isequal(size(G,3),size(covG,3),size(G_real,3),length(w)) 13 | error('Number of frequencies points should be the same!') 14 | end 15 | else 16 | if ~isequal(size(G,3),size(covG,3),length(w)) 17 | error('Number of frequencies points should be the same!') 18 | end 19 | end 20 | 21 | % from Lennart 22 | sda = real(sqrt((real(G).^2).*covG(:,:,:,1,1) + 2*(real(G).*imag(G)).*covG(:,:,:,2,1) + (imag(G).^2).*covG(:,:,:,2,2)))./abs(G); 23 | 24 | l = size(G,1); 25 | r = size(G,2); 26 | for i = 1:l 27 | for j = 1:r 28 | subplot(l,r,j+(i-1)*r); 29 | hold on; 30 | patchplot(w./(2*pi),mag2db(squeeze(abs(G(i,j,:))))',mag2db(max(squeeze(abs(G(i,j,:)))-sd.*squeeze(sda(i,j,:)),1e-5))',mag2db(max(squeeze(abs(G(i,j,:)))+sd.*squeeze(sda(i,j,:)),1e-5))'); 31 | if nargin > 5 32 | plot(w./(2*pi),mag2db(squeeze(abs(G_real(i,j,:))))','k--'); 33 | end 34 | vline((pi/h)/(2*pi),'k'); 35 | xlabel('Frequency (Hz)'); 36 | ylabel('Magnitude (dB)'); 37 | logx; 38 | box on; 39 | hold off; 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /dbodepatch.m: -------------------------------------------------------------------------------- 1 | function dbodepatch(G,G_min,G_max,w,h,G_real) 2 | %DBODEPATCH Bode diagram with given error bounds 3 | % dbodepatch(G,Gmin,Gmax,w,h) plots the bode diagram (magnitude and phase) 4 | % using the estimated frequency response given in G and the frequency 5 | % bounds given in Gmin and Gmax, the frequencies w, and sample time h. 6 | % 7 | % dbodepatch(G,Gmin,Gmax,w,h,Greal) includes the plot of the frequency 8 | % response given in Greal. 9 | 10 | % Ivo Houtzager 11 | % Delft Center of Systems and Control 12 | % Delft University of Technology 13 | % The Netherlands, 2010 14 | 15 | if nargin > 5 16 | if ~isequal(size(G,3),size(G_min,3),size(G_max,3),size(G_real,3),length(w)) 17 | error('Number of frequencies points should be the same!') 18 | end 19 | else 20 | if ~isequal(size(G,3),size(G_min,3),size(G_max,3),length(w)) 21 | error('Number of frequencies points should be the same!') 22 | end 23 | end 24 | 25 | l = size(G,1); 26 | r = size(G,2); 27 | for i = 1:l 28 | for j = 1:r 29 | subplot(l*2,r,j+(i-1)*2*r); 30 | hold on; 31 | patchplot(w./(2*pi),mag2db(squeeze(abs(G(i,j,:))))',mag2db(squeeze(abs(G_min(i,j,:))))',mag2db(squeeze(abs(G_max(i,j,:))))'); 32 | if nargin > 5 33 | plot(w./(2*pi),mag2db(squeeze(abs(G_real(i,j,:))))','k--'); 34 | end 35 | vline((pi/h)/(2*pi),'k'); 36 | xlabel('Frequency (Hz)'); 37 | ylabel('Magnitude (dB)'); 38 | logx; 39 | box on; 40 | hold off; 41 | 42 | subplot(l*2,r,j+r+(i-1)*2*r); 43 | hold on; 44 | patchplot(w./(2*pi),rad2deg(unwrap(squeeze(angle(G(i,j,:)))))',rad2deg(unwrap(squeeze(angle(G_min(i,j,:)))))',rad2deg(unwrap(squeeze(angle(G_max(i,j,:)))))'); 45 | if nargin > 5 46 | plot(w./(2*pi),rad2deg(unwrap(squeeze(angle(G_real(i,j,:)))))','k--'); 47 | end 48 | vline((pi/h)/(2*pi),'k'); 49 | xlabel('Frequency (Hz)'); 50 | ylabel('Phase (degrees)'); 51 | logx; 52 | box on; 53 | hold off; 54 | end 55 | end 56 | end 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /dbodesd.m: -------------------------------------------------------------------------------- 1 | function dbodesd(G,covG,sd,w,h,G_real) 2 | %DBODESD Bode diagram with probalistic error bounds 3 | % dbodesd(G,cogG,sd,w,h) plots the bode diagram (magnitude and phase) 4 | % using the estimated frequency response given in G and the frequency 5 | % bounds given in covG and sd, the frequencies w, and sample time h. The 6 | % value sd is the standard deviation and is larger than zero. 7 | % 8 | % dbodesd(G,cogG,sd,w,h,Greal) includes the plot of the frequency 9 | % response given in Greal. 10 | 11 | % Ivo Houtzager 12 | % Delft Center of Systems and Control 13 | % Delft University of Technology 14 | % The Netherlands, 2010 15 | 16 | if nargin > 5 17 | if ~isequal(size(G,3),size(covG,3),size(G_real,3),length(w)) 18 | error('Number of frequencies points should be the same!') 19 | end 20 | else 21 | if ~isequal(size(G,3),size(covG,3),length(w)) 22 | error('Number of frequencies points should be the same!') 23 | end 24 | end 25 | 26 | % from Lennart 27 | sdamp = real(sqrt((real(G).^2).*covG(:,:,:,1,1) + 2*(real(G).*imag(G)).*covG(:,:,:,2,1) + (imag(G).^2).*covG(:,:,:,2,2)))./abs(G); 28 | sdphase = sqrt((imag(G).^2).*covG(:,:,:,1,1) - 2*(real(G).*imag(G)).*covG(:,:,:,2,1) + (real(G).^2).*covG(:,:,:,2,2))./(abs(G).^2); 29 | 30 | % G = unwrap(G); 31 | % if nargin > 5 32 | % G_real = unwrap(G_real); 33 | % end 34 | l = size(G,1); 35 | r = size(G,2); 36 | for i = 1:l 37 | for j = 1:r 38 | subplot(l*2,r,j+(i-1)*2*r); 39 | hold on; 40 | patchplot(w./(2*pi),mag2db(squeeze(abs(G(i,j,:))))',mag2db(max(squeeze(abs(G(i,j,:)))-sd.*squeeze(sdamp(i,j,:)),1e-5))',mag2db(max(squeeze(abs(G(i,j,:)))+sd.*squeeze(sdamp(i,j,:)),1e-5))'); 41 | if nargin > 5 42 | plot(w./(2*pi),mag2db(squeeze(abs(G_real(i,j,:))))','k--'); 43 | end 44 | vline((pi/h)/(2*pi),'k'); 45 | xlabel('Frequency (Hz)'); 46 | ylabel('Magnitude (dB)'); 47 | logx; 48 | box on; 49 | hold off; 50 | 51 | subplot(l*2,r,j+r+(i-1)*2*r); 52 | hold on; 53 | patchplot(w./(2*pi),rad2deg(unwrap(squeeze(angle(G(i,j,:)))))',rad2deg(unwrap(squeeze(angle(G(i,j,:))))-sd.*unwrap(squeeze(sdphase(i,j,:))))',rad2deg(unwrap(squeeze(angle(G(i,j,:))))+sd.*unwrap(squeeze(sdphase(i,j,:))))'); 54 | if nargin > 5 55 | plot(w./(2*pi),rad2deg(unwrap(squeeze(angle(G_real(i,j,:)))))','k--'); 56 | end 57 | vline((pi/h)/(2*pi),'k'); 58 | xlabel('Frequency (Hz)'); 59 | ylabel('Phase (degrees)'); 60 | logx; 61 | box on; 62 | hold off; 63 | end 64 | end 65 | end 66 | -------------------------------------------------------------------------------- /deigen.m: -------------------------------------------------------------------------------- 1 | function deigen(E,Er) 2 | %DEIGEN Eigenvalues plot 3 | % deigen(E) plot the system eigenvalues in E. 4 | % 5 | % deigen(E,Er) also plot the system eigenvalues in Er. 6 | 7 | % Ivo Houtzager 8 | % Delft Center of Systems and Control 9 | % Delft University of Technology 10 | % The Netherlands, 2010 11 | 12 | % Plot eigenvalues 13 | n = size(E,1); 14 | N = size(E,2); 15 | [cx,cy] = pol2cart(linspace(0,2*pi,1000),ones(1,1000)); 16 | hold on 17 | plot(cx,cy,'Color',[0.4 0.4 0.4]); 18 | if nargin == 4 19 | plot(real(Er),imag(Er),'k+','LineWidth',0.1,'MarkerEdgeColor','k','MarkerFaceColor','k','MarkerSize',30); 20 | end 21 | for i = 1:N 22 | plot(real(E(:,i)),imag(E(:,i)),'x','MarkerEdgeColor',[0.7 0.7 0.7],'MarkerFaceColor',[0.7 0.7 0.7],'MarkerSize',10); 23 | end 24 | axis equal 25 | axis([-1 1 -1 1]); 26 | xlabel('Real axis') 27 | ylabel('Imaginary axis') 28 | box on; 29 | hold off 30 | -------------------------------------------------------------------------------- /deigensd.m: -------------------------------------------------------------------------------- 1 | function deigensd(E,Ecov,sd,Er) 2 | %DEIGENSD Eigenvalues plot with probalistic error bounds 3 | % deigensd(E,Ecov) plot the system eigenvalues in E with the bounds given 4 | % in Ecov and sd. The value sd is the standard deviation and is larger 5 | % than zero. 6 | % 7 | % deigensd(E,Ecov,sd,Er) also plot the system eigenvalues in Er. 8 | 9 | % Ivo Houtzager 10 | % Delft Center of Systems and Control 11 | % Delft University of Technology 12 | % The Netherlands, 2010 13 | 14 | % Plot eigenvalues 15 | n = size(E,1); 16 | N = size(E,2); 17 | [cx,cy] = pol2cart(linspace(0,2*pi,1000),ones(1,1000)); 18 | hold on 19 | plot(cx,cy,'Color',[0.4 0.4 0.4]); 20 | if nargin == 4 21 | plot(real(Er),imag(Er),'k+','LineWidth',0.1,'MarkerEdgeColor','k','MarkerFaceColor','k','MarkerSize',30); 22 | end 23 | for i = 1:N 24 | plot(real(E(:,i)),imag(E(:,i)),'x','MarkerEdgeColor',[0.7 0.7 0.7],'MarkerFaceColor',[0.7 0.7 0.7],'MarkerSize',10); 25 | end 26 | for i = 1:n 27 | ellipsebnd(Ecov((i-1)*2+1:i*2,(i-1)*2+1:i*2),[real(E(i)); imag(E(i))],'conf',erf(sd/sqrt(2)),'style','k') 28 | end 29 | axis equal 30 | axis([-1 1 -1 1]); 31 | xlabel('Real axis') 32 | ylabel('Imaginary axis') 33 | box on; 34 | hold off 35 | end 36 | -------------------------------------------------------------------------------- /dmodx.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/dmodx.m -------------------------------------------------------------------------------- /dnyquist.m: -------------------------------------------------------------------------------- 1 | function dnyquist(G) 2 | %DNYQUIST Nyquist diagram 3 | % dnyquist(G) plots the nyquist diagram using the estimated 4 | % frequency response given in G. 5 | 6 | 7 | % Ivo Houtzager 8 | % Delft Center of Systems and Control 9 | % Delft University of Technology 10 | % The Netherlands, 2010 11 | 12 | l = size(G,1); 13 | r = size(G,2); 14 | for i = 1:l 15 | for j = 1:r 16 | subplot(l,r,j+(i-1)*r); 17 | hold on; 18 | [sdreal,sdimag] = pol2cart(unwrap(squeeze(angle(G(i,j,:)))),max(squeeze(abs(G(i,j,:))),1e-5)); 19 | plot(sdreal',sdimag','k','Linewidth',2); 20 | %axis equal 21 | vline(0,'k:'); 22 | hline(0,'k:'); 23 | xlabel('Real axis'); 24 | ylabel('Imaginary axis'); 25 | box on; 26 | hold off; 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /dnyquistdet.m: -------------------------------------------------------------------------------- 1 | function dnyquistdet(G) 2 | %DNYQUISTDET Nyquist diagram (det(G)) 3 | % dnyquistdet(G) plots the nyquist diagram using the determinant of the 4 | % estimated frequency response given in G. 5 | 6 | % Ivo Houtzager 7 | % Delft Center of Systems and Control 8 | % Delft University of Technology 9 | % The Netherlands, 2010 10 | 11 | l = size(G,1); 12 | r = size(G,2); 13 | Gdet = zeros(1,size(G,3)); 14 | for i = 1:size(G,3) 15 | Gdet(i) = det(G(:,:,i)); 16 | end 17 | 18 | if l == r 19 | figure 20 | hold on; 21 | [sdreal,sdimag] = pol2cart(unwrap(squeeze(angle(Gdet))),max(squeeze(abs(Gdet)),1e-5)); 22 | plot(sdreal',sdimag','k','Linewidth',2); 23 | %axis equal; 24 | vline(0,'k:'); 25 | hline(0,'k:'); 26 | xlabel('Real axis'); 27 | ylabel('Imaginary axis'); 28 | box on; 29 | 30 | hold off; 31 | else 32 | error('Only for square MIMO systems!') 33 | end 34 | end 35 | 36 | 37 | -------------------------------------------------------------------------------- /dnyquistdetsd.m: -------------------------------------------------------------------------------- 1 | function dnyquistdetsd(G,covG,sd,Greal) 2 | %DNYQUISTDETSD Nyquist diagram with probalistic error bounds (det(G)) 3 | % dnyquistdetsd(G,covG,sd) plots the nyquist diagram using the determinant 4 | % of the estimated frequency response given in G and the frequency bounds 5 | % given in covG and sd. The value sd is the standard deviation and is 6 | % larger than zero. 7 | % 8 | % dnyquistdetsd(G,covG,sd,Greal) includes the plot of the determinant of 9 | % the frequency response given in Greal 10 | 11 | if nargin > 3 12 | if ~isequal(size(G,3),size(covG,3),size(Greal,3)) 13 | error('Number of frequencies points should be the same!') 14 | end 15 | else 16 | if ~isequal(size(G,3),size(covG,3)) 17 | error('Number of frequencies points should be the same!') 18 | end 19 | end 20 | 21 | l = size(G,1); 22 | r = size(G,2); 23 | Gdet = zeros(1,size(G,3)); 24 | covGdet = zeros(2,2,size(G,3)); 25 | if nargin > 3 26 | Gdetreal = zeros(1,size(G,3)); 27 | end 28 | for k = 1:size(G,3) 29 | Gdet(1,k) = det(G(:,:,k)); 30 | if nargin > 3 31 | Gdetreal(1,k) = det(Greal(:,:,k)); 32 | end 33 | 34 | X = zeros(2*l,r); 35 | X(1:2:end,:) = real(G(:,:,k)); 36 | X(2:2:end,:) = imag(G(:,:,k)); 37 | J = jacobianest(@(x) deter(x,l,r),X(:)); 38 | P = zeros(l*r*2); 39 | for i = 1:l 40 | for j = 1:r 41 | P((i-1)*r*2+(j-1)*2+(1:2),(i-1)*r*2+(j-1)*2+(1:2)) = squeeze(covG(i,j,k,:,:)); 42 | end 43 | end 44 | covGdet(:,:,k) = J*P*J'; 45 | end 46 | 47 | if l == r 48 | figure 49 | hold on; 50 | [sdreal,sdimag] = pol2cart(unwrap(angle(Gdet)),max(squeeze(abs(Gdet)),1e-5)); 51 | for k = 1:size(G,3) 52 | ellipsebnd(covGdet(:,:,k),[sdreal(k); sdimag(k)],'conf',erf(sd/sqrt(2)),'style','k') 53 | end 54 | plot(sdreal',sdimag','k','Linewidth',2); 55 | if nargin > 3 56 | [sdreal,sdimag] = pol2cart(unwrap(angle(Gdetreal)),max(squeeze(abs(Gdetreal)),1e-5)); 57 | plot(sdreal',sdimag','k--','Linewidth',1); 58 | end 59 | %axis equal; 60 | vline(0,'k:'); 61 | hline(0,'k:'); 62 | xlabel('Real axis'); 63 | ylabel('Imaginary axis'); 64 | box on; 65 | hold off; 66 | else 67 | error('Only for square MIMO systems!') 68 | end 69 | end 70 | 71 | function dD = deter(G,l,r) 72 | Gr = G(1:2:end,:); 73 | Gi = G(2:2:end,:); 74 | G = reshape(Gr,l,r) + 1i.*reshape(Gi,l,r); 75 | D = det(G); 76 | dD = zeros(2,1); 77 | dD(1,1) = real(D); 78 | dD(2,1) = imag(D); 79 | end 80 | -------------------------------------------------------------------------------- /dnyquistsd.m: -------------------------------------------------------------------------------- 1 | function dnyquistsd(G,covG,sd,G_real) 2 | %DNYQUISTSD Nyquist diagram with probalistic error bounds 3 | % dnyquistsd(G,covG,sd) plots the nyquist diagram using the estimated 4 | % frequency response given in G and the frequency bounds given in covG and 5 | % sd. The value sd is the standard deviation and is larger than zero. 6 | % 7 | % dnyquistsd(G,covG,sd,Greal) includes the plot of the frequency response 8 | % given in Greal. 9 | 10 | % Ivo Houtzager 11 | % Delft Center of Systems and Control 12 | % Delft University of Technology 13 | % The Netherlands, 2010 14 | 15 | if nargin > 3 16 | if ~isequal(size(G,3),size(covG,3),size(G_real,3)) 17 | error('Number of frequencies points should be the same!') 18 | end 19 | else 20 | if ~isequal(size(G,3),size(covG,3)) 21 | error('Number of frequencies points should be the same!') 22 | end 23 | end 24 | 25 | l = size(G,1); 26 | r = size(G,2); 27 | for i = 1:l 28 | for j = 1:r 29 | subplot(l,r,j+(i-1)*r); 30 | hold on; 31 | [sdreal,sdimag] = pol2cart(unwrap(squeeze(angle(G(i,j,:)))),max(squeeze(abs(G(i,j,:))),1e-5)); 32 | for k = 1:size(G,3) 33 | ellipsebnd(squeeze(covG(i,j,k,:,:)),[sdreal(k); sdimag(k)],'conf',erf(sd/sqrt(2)),'style','k') 34 | end 35 | plot(sdreal',sdimag','k','Linewidth',2); 36 | if nargin > 3 37 | [sdreal,sdimag] = pol2cart(unwrap(squeeze(angle(G_real(i,j,:)))),max(squeeze(abs(G_real(i,j,:))),1e-5)); 38 | plot(sdreal',sdimag','k--','Linewidth',1); 39 | end 40 | %axis equal; 41 | vline(0,'k:'); 42 | hline(0,'k:'); 43 | xlabel('Real axis'); 44 | ylabel('Imaginary axis'); 45 | box on; 46 | hold off; 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /doc/Houtzager_CDC09.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/doc/Houtzager_CDC09.pdf -------------------------------------------------------------------------------- /doc/Houtzager_CompressedMarkov.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/doc/Houtzager_CompressedMarkov.pdf -------------------------------------------------------------------------------- /doc/Houtzager_LSL.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/doc/Houtzager_LSL.pdf -------------------------------------------------------------------------------- /doc/Houtzager_SYSID09.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/doc/Houtzager_SYSID09.pdf -------------------------------------------------------------------------------- /doc/Wingerden_Automatica09.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/doc/Wingerden_Automatica09.pdf -------------------------------------------------------------------------------- /doc/Wingerden_CDC08.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/doc/Wingerden_CDC08.pdf -------------------------------------------------------------------------------- /doc/Wingerden_CDC09.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/doc/Wingerden_CDC09.pdf -------------------------------------------------------------------------------- /doc/Wingerden_IJRNC09.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/doc/Wingerden_IJRNC09.pdf -------------------------------------------------------------------------------- /doc/Wingerden_SYSID09.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/doc/Wingerden_SYSID09.pdf -------------------------------------------------------------------------------- /doc/Wingerden_a_variance_PBSIDopt.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/doc/Wingerden_a_variance_PBSIDopt.pdf -------------------------------------------------------------------------------- /doc/html/TULogo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/doc/html/TULogo.gif -------------------------------------------------------------------------------- /doc/html/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/doc/html/Thumbs.db -------------------------------------------------------------------------------- /doc/html/subspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/doc/html/subspace.png -------------------------------------------------------------------------------- /doc/pbsid_install.m: -------------------------------------------------------------------------------- 1 | %% Installation 2 | % The version 0.5 of the Predictor-Based Subspace IDentification Toolbox is 3 | % recommended with Matlab 7.11 (R2010B). Although older Matlab versions 4 | % should also work. The m-files should work on all platforms. The mex-files 5 | % can be compiled under Windows, Mac and Linux, other platforms have not 6 | % been checked. 7 | % 8 | % * Download and unzip the PBSIDToolbox-0.5.zip in a directory. If you 9 | % upgrade from an older version, first empty the previous directory. 10 | % 11 | % * Run |pbsidsetup| to add the directory to the path and compile the mex 12 | % files. Save the path for the next start of Matlab. 13 | % 14 | % * Restart Matlab. From the Start button, select Toolboxes > 15 | % Predictor-Based Subspace Identification Toolbox to check that the toolbox 16 | % is correctly recognized by your system. 17 | % 18 | % * If you upgrade from an earlier version, type rehash toolbox to make 19 | % sure that Matlab refreshes the function cache. 20 | % 21 | % * Run the examples to look if the functions are running correctly. 22 | % 23 | 24 | 25 | -------------------------------------------------------------------------------- /doc/pbsid_releasenotes.m: -------------------------------------------------------------------------------- 1 | %% Release Notes 2 | 3 | %% Predictor-Based Subspace IDentification Toolbox 4 | % 5 | % V0.6 (February 2015) 6 | % 7 | % * Fixed a number of bugs 8 | % V0.5 (January 2012) 9 | % 10 | % * added BPDN regularization for |dordvarx| and |lordvarx|, see example 19b 11 | % * added predictor stabilization option for |lx2abcdk|, see example 19c 12 | % * function |predstab| to assess stability of the predictor form 13 | % * more memory-efficient batch-wise computations in |dordvarx| 14 | % * added function |bodemag| for |idafflpv| object, for LPV Bode magnitude plots 15 | % * correction of bugs in |lordvarx| and |regress| 16 | % * option to use obs. matrix with mu= [1,1..,1] in |lordvarx| 17 | % 18 | % V0.4 (December 2010) 19 | % 20 | % * added functions to estimate the asymptoic variance of the PBSIDopt 21 | % (VARX) estimates 22 | % * added functions for plotting the bode and eigenvalues with error bounds 23 | % 24 | % V0.3 (Oktober 2010) 25 | % 26 | % * regularisation parameter can be now be given by user 27 | % * added the recursive function |rpbsid| 28 | % * added the simulink blocks for real-time recursive identification 29 | % * added examples with the recursive function |rpbsid| 30 | % 31 | % V0.2 (Augustus 2010) 32 | % 33 | % * improved and new functions (|pem|, |pe|, etc) for IDAFFLPV object 34 | % * new functions to convert to IDSS object 35 | % * batch updating of |dordfir|, |dordvarx|, and |dordvarmax| improved 36 | % * new function |idmultisine| to generate multi sine excitation signals 37 | % * add stability option in |dx2abcdk.m| 38 | % * corrected bugs in |lordvarx| and |lx2abcdk| 39 | % * added more documentation 40 | % 41 | % V0.1 (December 2009) 42 | % 43 | % * first release of the PBSID Toolbox 44 | -------------------------------------------------------------------------------- /dordvarx.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/dordvarx.m -------------------------------------------------------------------------------- /dvar2eig.m: -------------------------------------------------------------------------------- 1 | function [E,covE] = dvar2eig(P,A) 2 | %DVAR2EIG Eigenvalues and its covariance estimation 3 | % [E,covE]=dvar2frd(P,A) returns the estimated eigenvalues and its 4 | % covariance for the state space matrix A and its covariance P. 5 | 6 | % Ivo Houtzager 7 | % Delft Center of Systems and Control 8 | % Delft University of Technology 9 | % The Netherlands, 2010 10 | 11 | n = size(A,1); 12 | P = P(1:n^2,1:n^2); 13 | J = jacobianest(@(x) eigen(x,n),A(:)); 14 | covE = J*P*J'; 15 | E = eig(A); 16 | end 17 | 18 | function dE = eigen(A,n) 19 | A = reshape(A,n,n); 20 | E = eig(A); 21 | dE = zeros(2*n,1); 22 | dE(1:2:end) = real(E); 23 | dE(2:2:end) = imag(E); 24 | end 25 | -------------------------------------------------------------------------------- /dvar4varx.m: -------------------------------------------------------------------------------- 1 | function [P,sigma] = dvar4varx(u,y,p,VARX,Zps) 2 | %DVAR4VARX Asymptotic variance of the VARX estimation 3 | % P=dvar4varx(u,y,p,VARX,Zps) returns the covariance of the VARX 4 | % estimation and acts as a pre-processor for dvar2frd. The latter is used 5 | % to calculate the probalistic error bounds around the identified bode 6 | % diagrams. The input matrix u, output matrix y, past window p, regression 7 | % model VARX, and data matrix Zps (obtained from dordvarx) must have the 8 | % same number of observations. 9 | % 10 | % [P,sigma]=dvar4varx(u,y,p,VARX,Zps) also returns the covariance matrix 11 | % of the innovation noise. 12 | 13 | % Ivo Houtzager 14 | % Delft Center of Systems and Control 15 | % Delft University of Technology 16 | % The Netherlands, 2010 17 | 18 | % check number if input arguments 19 | if nargin < 5 20 | error('DVAR4VARX requires five input arguments.') 21 | end 22 | 23 | % check dimensions of inputs 24 | if size(y,2) < size(y,1) 25 | y = y'; 26 | end 27 | N = size(y,2); 28 | l = size(y,1); 29 | if isempty(u); 30 | r = 0; 31 | u = zeros(0,N); 32 | else 33 | if size(u,2) < size(u,1) 34 | u = u'; 35 | end 36 | r = size(u,1); 37 | if ~isequal(N,length(u)) 38 | error('The number of rows of vectors/matrices u and y must be the same.') 39 | end 40 | end 41 | if l == 0 42 | error('DVAR4VARX requires an output vector y.') 43 | end 44 | 45 | % store the past and future vectors 46 | m = r+l; 47 | z = [u; y]; 48 | Z = zeros(p*m,N-p); 49 | for i = 1:p 50 | Z((i-1)*m+1:i*m,:) = z(:,i:N+i-p-1); 51 | end 52 | 53 | % solve VARX problem 54 | Y = y(:,p+1:N); 55 | U = u(:,p+1:N); 56 | if size(VARX,2)/m > p 57 | Z = [Z; U]; 58 | end 59 | 60 | % calculate the innovation sequence 61 | E = Y - VARX*Z; 62 | sigma = (E*E')/length(E); 63 | 64 | P = zeros(l*size(Zps,2),l*size(Zps,2)); 65 | % asymptotic variance 66 | % P = kron(Zps',eye(l))*sparse(kron(speye(N-p),sigma))*kron(Zps',eye(l))'; 67 | % computed sample-by-sample for memory efficiency 68 | P = zeros(l*size(Zps,2),l*size(Zps,2)); 69 | for j = 1:size(Zps,1) 70 | P = P + kron(Zps(j,:)',eye(l))*sigma*kron(Zps(j,:),eye(l)); 71 | end 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /examples/SfunctionLPV.m: -------------------------------------------------------------------------------- 1 | function [Sys,x0]=SfunctionLPV(t,x,u,flag,A,B,C,D) 2 | 3 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | % define topology model 5 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6 | NumContStates = 0; 7 | NumDiscStates = 7; 8 | NumOutputs = 6; 9 | NumInputs = 10; 10 | DirFeedthrough = 0; 11 | NumSampleTimes = 1; % at least one sample time is needed 12 | 13 | n = 7; 14 | r = 7; 15 | 16 | A0 = A(:,1:n); 17 | A1 = A(:,n+1:2*n); 18 | A2 = A(:,2*n+1:3*n); 19 | A3 = A(:,3*n+1:4*n); 20 | B0 = B(:,1:r); 21 | B1 = B(:,r+1:2*r); 22 | B2 = B(:,2*r+1:3*r); 23 | B3 = B(:,3*r+1:4*r); 24 | C0 = C(:,1:n); 25 | C1 = C(:,n+1:2*n); 26 | C2 = C(:,2*n+1:3*n); 27 | C3 = C(:,3*n+1:4*n); 28 | D0 = D(:,1:r); 29 | D1 = D(:,r+1:2*r); 30 | D2 = D(:,2*r+1:3*r); 31 | D3 = D(:,3*r+1:4*r); 32 | 33 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 34 | % initialize model 35 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 36 | 37 | if abs(flag) == 0, % return sizes of parameters and initial conditions 38 | 39 | Sys = [NumContStates NumDiscStates NumOutputs NumInputs DirFeedthrough NumSampleTimes]; 40 | 41 | x0 = [0 0 0 0 0 0 0]; 42 | 43 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 44 | % update of discrete states 45 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 46 | 47 | elseif abs(flag) == 2, 48 | 49 | % rename inputs 50 | mu1 = u(8); 51 | mu2 = u(9); 52 | mu3 = u(10); 53 | u = u(1:7); 54 | 55 | % define model equations 56 | Sys = A0*x + (A1.*mu1)*x + (A2.*mu2)*x + (A3.*mu3)*x +... 57 | B0*u + (B1.*mu1)*u + (B2.*mu2)*u + (B3.*mu3)*u; 58 | 59 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 60 | % calculate outputs 61 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 62 | elseif abs(flag) == 3, % return output vector 63 | 64 | % rename inputs 65 | mu1 = u(8); 66 | mu2 = u(9); 67 | mu3 = u(10); 68 | u = u(1:7); 69 | 70 | Sys = C0*x + (C1.*mu1)*x + (C2.*mu2)*x + (C3.*mu3)*x +... 71 | D0*u + (D1.*mu1)*u + (D2.*mu2)*u + (D3.*mu3)*u; 72 | 73 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 74 | else % no need to return anything 75 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 76 | Sys=[]; 77 | end -------------------------------------------------------------------------------- /examples/dplqr.m: -------------------------------------------------------------------------------- 1 | function [K,S,E] = dplqr(A,B,Q,R,F,N) 2 | %DPLQR Dynamic programming of LQR design for a discrete state-space system. 3 | % [K,S,E] = DPLQR(A,B,Q,R,F,N) calculates the optimal gain matrices K[n] 4 | % such that: 5 | % 6 | % For a discrete-time state-space model SYS, u[n] = -K[n]x[n] minimizes 7 | % 8 | % J = 0.5*Sum {x[n]'Qx[n] + u[n]'Ru[n]} + 0.5*x[N]'Fx[N] 9 | % 10 | % subject to x[n+1] = Ax[n] + Bu[n] with n = 0...N-1. 11 | % 12 | % Also returned are the the solution S of the associated algebraic 13 | % Riccati equation and the closed-loop eigenvalues E = EIG(A-B*K). 14 | 15 | % Ivo Houtzager 16 | % Delft Center of Systems and Control 17 | % Delft University of Technology 18 | % The Netherlands, 2010 19 | 20 | % check number of input arguments 21 | if nargin < 5 22 | error('DPLQR requires at least five or six input arguments') 23 | end 24 | if ndims(A) > 2; 25 | array = 2; 26 | else 27 | array = 1; 28 | end 29 | 30 | % check dimensions and symmetry 31 | [nax ns nna] = size(A); 32 | [nbx nb nnb] = size(B); 33 | [nqx nq nnq] = size(Q); 34 | [nfx nf nnf] = size(F); 35 | [nrx nr nnr] = size(R); 36 | if ~isequal(nna,nnb,nnq,nnr,N); 37 | if array == 2 38 | error('The number of arrays have to be equal to N.'); 39 | end 40 | end 41 | if ~isequal(nbx,nax); 42 | error('The A and B matrices must have the same number of rows.') 43 | end 44 | if ~isequal(nqx,nax,nfx,ns,nq,nf); 45 | error('The A, Q and F matrices must be the same size.') 46 | end 47 | if ~isequal(nrx,nr,nb); 48 | error('The R matrix must be square with as many columns as B.') 49 | end 50 | if ~isreal(Q) || ~isreal(R) 51 | error('The weight matrices Q, R must be real valued.') 52 | end 53 | 54 | % backwards iteration 55 | K = zeros(nb,ns,N); 56 | E = zeros(ns,N); 57 | S = zeros(ns,ns,N); 58 | S(:,:,N+1) = F; 59 | switch array 60 | case 1 61 | for t = N:-1:1 62 | K(:,:,t) = (R + B'*S(:,:,t+1)*B)\B'*S(:,:,t+1)*A; 63 | S(:,:,t) = (A - B*K(:,:,t))'*S(:,:,t+1)*(A - B*K(:,:,t)) + K(:,:,t)'*R*K(:,:,t) + Q; 64 | if nargout >= 2 65 | E(:,t) = eig(A - B*K(:,:,t)); 66 | end 67 | end 68 | case 2 69 | for t = N:-1:1 70 | K(:,:,t) = (R(:,:,t) + B(:,:,t)'*S(:,:,t+1)*B(:,:,t))\B(:,:,t)'*S(:,:,t+1)*A(:,:,t); 71 | S(:,:,t) = (A(:,:,t) - B(:,:,t)*K(:,:,t))'*S(:,:,t+1)*(A(:,:,t) - B(:,:,t)*K(:,:,t)) + K(:,:,t)'*R(:,:,t)*K(:,:,t) + Q(:,:,t); 72 | if nargout >= 2 73 | E(:,t) = eig(A(:,:,t) - B(:,:,t)*K(:,:,t)); 74 | end 75 | end 76 | end 77 | 78 | -------------------------------------------------------------------------------- /examples/ex06_lti_four_unc.m: -------------------------------------------------------------------------------- 1 | %% Example 6: Uncertainty bounds on estimation using first-order variance for PBSIDopt 2 | close all; clear; clc; 3 | addpath D:\Werk_Data\Software\PBSIDToolbox-0.6 4 | %% The fourth-order LTI model with coloured process noise 5 | 6 | % state-space matrices 7 | A = [0.67 0.67 0 0; -0.67 0.67 0 0; 0 0 -0.67 -0.67; 0 0 0.67 -0.67]; 8 | B = [0.6598 -0.5256; 1.9698 0.4845; 4.3171 -0.4879; -2.6436 -0.3416]; 9 | K = [-0.6968 -0.1474; 0.1722 0.5646; 0.6484 -0.4660; -0.9400 0.1032]; 10 | C = [-0.3749 0.0751 -0.5225 0.5830; -0.8977 0.7543 0.1159 0.0982]; 11 | D = zeros(2); 12 | 13 | % open-loop system 14 | OL = ss(A,[B K],C,[D eye(2)],1); 15 | 16 | %% Open-loop identification experiment 17 | % Simulation of the model in open loop 18 | 19 | % input signals 20 | N = 4000; % number of samples 21 | t = (0:N-1)'; % time samples 22 | r = randn(N,2); % excitation signal 23 | 24 | % noise 25 | e = randn(N,2); % noise signal 26 | 27 | % simulation 28 | y0 = lsim(OL,[r zeros(N,2)],t); 29 | y = lsim(OL,[r e],t); 30 | disp('Signal to noise ratio (SNR) (open-loop)') 31 | snr(y,y0) 32 | 33 | %% 34 | % Identification of the model in open loop 35 | 36 | % parameters 37 | n = 4; % order of system 38 | f = 10; % future window size 39 | p = 10; % past window size 40 | 41 | % PBSID-varx 42 | [S,X,VARX,U,Zps] = dordvarx(r,y,f,p); 43 | figure, semilogy(S,'*'); 44 | x = dmodx(X,n); 45 | [Ai,Bi,Ci,Di,Ki] = dx2abcdk(x,r,y,f,p,'nostable'); 46 | 47 | 48 | %% VARX identification results 49 | % Representing the results in the frequency domain 50 | 51 | % Frequency grid 52 | w = logspace(-2,log10(pi),1000); 53 | 54 | % Frequency response of identified system 55 | Gr = freqresp(OL(1:2,1:4),w); 56 | tic 57 | [P,sigma] = dvar4varx(r,y,p,VARX,Zps); 58 | toc 59 | [Gi,covG] = dvar2frd(P,w,1,p,VARX); 60 | figure('Units','normalized','Position',[0 0 1 1]), 61 | dbodemagsd(Gi,covG,2.8,w,1,Gr); 62 | 63 | 64 | %% PBSIDopt identification results 65 | % Representing the results in the frequency domain 66 | 67 | % Frequency response of identified system 68 | Gr = freqresp(OL(1:2,1:4),w); 69 | [P,sigma] = dvar4abcdk(x,r,y,f,p,Ai,Bi,Ci,Di,Ki,U,Zps); 70 | [Gi,covG] = dvar2frd(P,w,1,Ai,Bi,Ci,Di,Ki); 71 | figure('Units','normalized','Position',[0 0 1 1]), 72 | dbodemagsd(Gi,covG,2.8,w,1,Gr); 73 | 74 | figure('Units','normalized','Position',[0 0 1 1]), 75 | dnyquistsd(Gi,covG,2.8,Gr); 76 | 77 | % Eigenvalues with ellipse bound 78 | [E,covE] = dvar2eig(P,Ai); 79 | figure, deigensd(E,covE,2.8,eig(A)); 80 | 81 | -------------------------------------------------------------------------------- /examples/ex14_hamm_four.m: -------------------------------------------------------------------------------- 1 | %% Example 14: Fourth-order Hammerstein model 2 | close all; clear; clc; 3 | 4 | %% The fourth-order LTI model with coloured process noise 5 | 6 | % state-space matrices 7 | A = [0.67 0.67 0 0; -0.67 0.67 0 0; 0 0 -0.67 -0.67; 0 0 0.67 -0.67]; 8 | B = [0.6598 -0.5256; 1.9698 0.4845; 4.3171 -0.4879; -2.6436 -0.3416]; 9 | K = [-0.6968 -0.1474; 0.1722 0.5646; 0.6484 -0.4660; -0.9400 0.1032]; 10 | C = [-0.3749 0.0751 -0.5225 0.5830; -0.8977 0.7543 0.1159 0.0982]; 11 | D = zeros(2); 12 | 13 | % open-loop system 14 | OL = ss(A,[B K],C,[D eye(2)],1); 15 | 16 | %% Open-loop identification experiment 17 | % Simulation of the model in open loop 18 | 19 | % input signals 20 | N = 1000; % number of samples 21 | t = (0:N-1)'; % time samples 22 | r = randn(N,2); % excitation signal 23 | fu = [sinc(r(:,1)).*r(:,1).^2 sin(r(:,2))]; 24 | 25 | % noise 26 | e = 0.04.*randn(N,2); % noise signal 27 | 28 | % simulation of open loop 29 | y0 = lsim(OL,[fu zeros(N,2)],t); 30 | y = lsim(OL,[fu e],t); 31 | disp('Signal to noise ratio (SNR) (open-loop)') 32 | snr(y,y0) 33 | 34 | %% 35 | % Identification of the model in open loop 36 | 37 | % parameters 38 | n = 4; % order of system 39 | f = 10; % future window size 40 | p = 10; % past window size 41 | 42 | % PBSID-varx 43 | [us,Du,ys,Dy] = sigscale(r,y); 44 | [S,x,fui] = hordvarx(us,ys,f,p,'tikh','gcv'); 45 | figure, semilogy(S,'*'); 46 | x = hmodx(x,n); 47 | [Ai,Bi,Ci,Di] = hx2abcdk(x,fui,ys,f,p); 48 | 49 | %% 50 | % Verification results 51 | 52 | % verification using variance accounted for (VAF) (open loop) 53 | Q = fu(p+1:p+size(fui,2),:)'*pinv(fui); 54 | OLi = ss(Ai,(Bi/Q)/Du,Dy*Ci,Dy*((Di/Q)/Du),1); 55 | figure, bodemag(OL(1:2,1:2),'k',OLi,'r'); 56 | y = lsim(OL(1:2,1:2),fu,t); 57 | yi = lsim(OLi,fu,t); 58 | disp('VAF (open-loop)') 59 | vaf(y,yi) 60 | 61 | 62 | 63 | % simulation (open loop) 64 | figure, bodemag(OL(1:2,1:2),'k',OLi,'r'); 65 | legend('REAL','IDENT'); 66 | 67 | % plot the non-linear function 68 | fui = Q*Du*fui; 69 | figure, subplot(1,2,1), plot(r(:,1),fu(:,1),'k.',r(p+1:p+size(fui,2),1),fui(1,:)','r.') 70 | subplot(1,2,2), plot(r(:,2),fu(:,2),'k.',r(p+1:p+size(fui,2),2),fui(2,:)','r.') 71 | 72 | -------------------------------------------------------------------------------- /examples/ex15_wiener_four.m: -------------------------------------------------------------------------------- 1 | %% Example 15: Fourth-order Wiener model 2 | close all; clear; clc; 3 | 4 | %% The fourth-order LTI model with coloured process noise 5 | 6 | % state-space matrices 7 | A = [0.67 0.67 0 0; -0.67 0.67 0 0; 0 0 -0.67 -0.67; 0 0 0.67 -0.67]; 8 | B = [0.6598 -0.5256; 1.9698 0.4845; 4.3171 -0.4879; -2.6436 -0.3416]; 9 | K = [-0.6968 -0.1474; 0.1722 0.5646; 0.6484 -0.4660; -0.9400 0.1032]; 10 | C = [-0.3749 0.0751 -0.5225 0.5830; -0.8977 0.7543 0.1159 0.0982]; 11 | D = zeros(2); 12 | 13 | % open-loop system 14 | OL = ss(A,[B K],C,[D eye(2)],1); 15 | 16 | %% Open-loop identification experiment 17 | % Simulation of the model in open loop 18 | 19 | % input signals 20 | N = 1000; % number of samples 21 | t = (0:N-1)'; % time samples 22 | r = randn(N,2); % excitation signal 23 | 24 | % noise 25 | e = 0.04.*randn(N,2); % noise signal 26 | 27 | % simulation of open loop 28 | y0 = lsim(OL,[r zeros(N,2)],t); 29 | y = lsim(OL,[r e],t); 30 | fy = [sign(y(:,1)).*sqrt(abs(y(:,1))) sign(y(:,2)).*sqrt(abs(y(:,2)))]; 31 | disp('Signal to noise ratio (SNR) (open-loop)') 32 | snr(y,y0) 33 | 34 | %% 35 | % Identification of the model in open loop 36 | 37 | % parameters 38 | n = 4; % order of system 39 | f = 10; % future window size 40 | p = 10; % past window size 41 | 42 | % PBSID-varx (open loop) 43 | [us,Du,ys,Dy] = sigscale(r,fy); 44 | [S,x,yi] = wordvarx(us,ys,f,p,1e-4,1e-8); 45 | figure, semilogy(S,'*'); 46 | x = wmodx(x,n); 47 | [Ai,Bi,Ci,Di,Ki] = wx2abcdk(x,us,yi,f,p); 48 | 49 | %% 50 | % Verification results 51 | 52 | % variance accounted for (open loop) 53 | Qy = (Dy\y(p+1:p+size(yi,2),:)')*pinv(yi); 54 | OLi = ss(Ai,Bi/Du,Dy*Qy*Ci,Dy*Qy*Di,1); 55 | yv = lsim(OL(1:2,1:2),r,t); 56 | ye = lsim(OLi,r,t); 57 | disp('VAF (open-loop)') 58 | vaf(yv,ye) 59 | 60 | %% 61 | % Identification results 62 | 63 | % plot eigenvalues (open loop) 64 | figure 65 | hold on 66 | title('poles of identified system (open-loop)') 67 | [cx,cy] = pol2cart(linspace(0,2*pi),ones(1,100)); 68 | plot(cx,cy,'k'); 69 | plot(real(pole(OL)),imag(pole(OL)),'k+','LineWidth',0.1,'MarkerEdgeColor','k','MarkerFaceColor','k','MarkerSize',10); 70 | plot(real(eig(Ai)),imag(eig(Ai)),'rx'); 71 | axis([-1 1 -1 1]); 72 | axis square 73 | legend('STABBND','TRUE','IDENT','Location','East'); 74 | hold off 75 | 76 | % simulation (open loop) 77 | figure, bodemag(OL(1:2,1:2),'k',OLi,'y'); 78 | legend('REAL','IDENT'); 79 | 80 | % plot the non-linear function 81 | yi = Dy*Qy*yi; 82 | figure, subplot(1,2,1), plot(y(:,1),fy(:,1),'k.',yi(1,:)',fy(p+1:p+size(yi,2),1),'r.'); 83 | subplot(1,2,2), plot(y(:,2),fy(:,2),'k.',yi(2,:)',fy(p+1:p+size(yi,2),2),'r.'); -------------------------------------------------------------------------------- /examples/ex19_lpv_flap.m: -------------------------------------------------------------------------------- 1 | %% Example 19: Second-order LPV model of flapping dynamics 2 | close all; clear; clc; 3 | 4 | %% Flapping dynamics of a wind turbine 5 | 6 | % System matrices 7 | A1 = [0 0.0734; -6.5229 -0.4997]; 8 | A2 = [-0.0021 0; -0.0138 0.5196]; 9 | A12 = [A1 A2]; 10 | B12 = [-0.7221 0; -9.6277 0]; 11 | C12 = [1 0 0 0]; 12 | D12 = [0 0]; 13 | n = size(A12,1); % The order of the system 14 | m = size(A12,2)/n; % The number of scheduling parameters 15 | r = size(B12,2)/m; % The number of inputs 16 | l = size(C12,1); % The number of outputs 17 | 18 | %% Open-loop identification experiment 19 | % Simulation of the model in open loop 20 | 21 | % defining a number of constants 22 | j = 10; % period 23 | np = 100; % number of periods 24 | N = np*j; % number of data points 25 | 26 | % measured data from the scheduling parameters 27 | mu3 = cos(2*pi*(1:N)'./j) + 0.2; 28 | 29 | % make affine LPV system 30 | M = idafflpv(A12,B12,C12,D12,eye(2),zeros(2,1),1); 31 | 32 | % simulation of the system with noise 33 | t = (0:N-1)'; 34 | u = randn(N,r); 35 | e = 0.3.*randn(N,l); 36 | y0 = sim(M,u,t,mu3); 37 | y = sim(M,u,t,mu3,e); 38 | disp('Signal to noise ratio (SNR) (open-loop)') 39 | snr(y,y0) 40 | 41 | %% 42 | % Identification of the model in open loop 43 | 44 | % parameters 45 | p = 5; % past window size 46 | f = 3; % future window size 47 | 48 | % LPV identification with noise 49 | mu1 = ones(N,1); 50 | mu = [mu1 mu3]; 51 | [S,x] = lordvarx(u,y,mu,f,p,'tikh','gcv',[0 1 0]); 52 | x = lmodx(x,n); 53 | [A,B,C,D,K] = lx2abcdk(x,u,y,mu,f,p,[0 1 0]); 54 | figure, semilogy(S,'x'); 55 | title('Singular values') 56 | 57 | %% 58 | % Verification results 59 | 60 | % Simulation of identified LPV system 61 | Mk = idafflpv(A,B,C,D,K,zeros(2,1),1); 62 | yidk = sim(Mk,u,t,mu3,e); 63 | disp('VAF of identified LPV system ') 64 | vaf(y,yidk) 65 | 66 | 67 | %% 68 | % Identification results 69 | 70 | % Plot eigenvalues 71 | figure 72 | hold on 73 | title('poles of identified LPV system') 74 | [cx,cy] = pol2cart(linspace(0,2*pi),ones(1,100)); 75 | plot(cx,cy,'k'); 76 | plot(real(eig(A1)),imag(eig(A1)),'k+','LineWidth',0.1,'MarkerEdgeColor','k', 'MarkerFaceColor','k', 'MarkerSize',10); 77 | plot(real(eig(A(1:n,1:n))),imag(eig(A(1:n,1:n))),'bx'); 78 | plot(real(eig(A2)),imag(eig(A2)),'k+','LineWidth',0.1,'MarkerEdgeColor','k', 'MarkerFaceColor','k', 'MarkerSize',10); 79 | plot(real(eig(A(1:n,n+1:2*n))),imag(eig(A(1:n,n+1:2*n))),'bx'); 80 | axis([-1 1 -1 1]); 81 | axis square 82 | hold off 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /examples/ex22_plpv_mimo.m: -------------------------------------------------------------------------------- 1 | %% Example 22: Third-order SIMO Periodic-LPV model 2 | close all; clear; clc; 3 | 4 | %% Periodic third-order LPV model 5 | 6 | % System matrices 7 | A1 = [0 0.9 0.2; -0.9 0.5 0; -0.2 0 0.2]; 8 | A2 = [0.60 -0.5 0.5; 0.50 0.60 0; -0.5 0 0.6]; 9 | A12 = [A1 A2]; 10 | B12 = [1 0.4; 1 0.2 ; 1 0.12]; 11 | C12 = [0.2 1 0.5 0.2 0.1 1; 0.2 0.1 1 0.3 0.4 0.8]; 12 | D12 = [0.1 0.2; 0.2 0.1]; 13 | K0 = [0.0130 0.0225; 0.0089 0.0060; 0.0002 -0.0010]; 14 | 15 | n = size(A12,1); % The order of the system 16 | m = size(A12,2)/n; % The number of scheduling parameters 17 | r = size(B12,2)/m; % The number of inputs 18 | l = size(C12,1); % The number of outputs 19 | 20 | %% Open-loop identification experiment 21 | % Simulation of the model in open loop 22 | 23 | % Defining a number of constants 24 | j = 18; % period 25 | np = 1000; % number of periods 26 | N = np*j; % number of data points 27 | 28 | % Measured data and the scheduling parameters 29 | t = (0:N-1)'; 30 | u = randn(N,r); 31 | mu1 = 0.8*sin(2*pi*(1:N)'./j) + 0.2; 32 | mu3 = 0.8*cos(2*pi*(1:N)'./j) + 0.2; 33 | mu = [mu1 mu3]; 34 | 35 | % Simulation of the system without noise 36 | Alpv = [zeros(n) A12]; 37 | Blpv = [zeros(n,r) B12]; 38 | Clpv = [zeros(l,n) C12]; 39 | Dlpv = [zeros(l,r) D12]; 40 | Klpv = [K0 zeros(n,2*l)]; 41 | M = idafflpv(Alpv,Blpv,Clpv,Dlpv,Klpv,[],1); 42 | y0 = sim(M,u,t,mu); 43 | 44 | % Simulation of the system with noise 45 | e = 0.1.*randn(N,l); 46 | y = sim(M,u,t,mu,e); 47 | disp('Signal to noise ratio (SNR) (open-loop)') 48 | snr(y,y0) 49 | 50 | %% 51 | % Identification of the model in open loop 52 | 53 | % Defining a number of constants 54 | p = 7; % past window size 55 | f = 7; % past window size 56 | 57 | % LPV identification without noise 58 | pnd = pschedclust(mu,f,p); 59 | [S,X,TU,K] = pordvarx(u,y,mu,f,p,pnd,'tikh','gcv',0,[0 0 0 0 1]); 60 | [x,CC] = pmodx(X,TU,K,n,1e-4,1e-8); 61 | [A,B,C,D,K] = px2abcdk(x,u,y,mu,f,p,[0 0 0 0 1],pnd); 62 | figure, semilogy(S,'x'); 63 | title('Singular values') 64 | disp('Canonical correlation coefficients') 65 | CC(1:n) 66 | 67 | 68 | %% 69 | % Verification results 70 | 71 | % Simulation of identified LPV system 72 | Aidm = [zeros(n) A]; 73 | Bidm = [zeros(n,r) B]; 74 | Cidm = [zeros(l,n) C]; 75 | Didm = [zeros(l,r) D]; 76 | Kidm = [zeros(n,l) K]; 77 | Mm = idafflpv(Aidm,Bidm,Cidm,Didm,Kidm,[],1); 78 | yidm = sim(Mm,u,t,mu); 79 | disp('VAF of identified LPV system') 80 | vaf(y,yidm) 81 | -------------------------------------------------------------------------------- /examples/html/ex01_lti_four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex01_lti_four.png -------------------------------------------------------------------------------- /examples/html/ex01_lti_four_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex01_lti_four_01.png -------------------------------------------------------------------------------- /examples/html/ex01_lti_four_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex01_lti_four_02.png -------------------------------------------------------------------------------- /examples/html/ex01_lti_four_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex01_lti_four_03.png -------------------------------------------------------------------------------- /examples/html/ex01_lti_four_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex01_lti_four_04.png -------------------------------------------------------------------------------- /examples/html/ex01_lti_four_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex01_lti_four_05.png -------------------------------------------------------------------------------- /examples/html/ex01_lti_four_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex01_lti_four_06.png -------------------------------------------------------------------------------- /examples/html/ex01_lti_four_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex01_lti_four_07.png -------------------------------------------------------------------------------- /examples/html/ex01_lti_four_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex01_lti_four_08.png -------------------------------------------------------------------------------- /examples/html/ex02_lti_four_fir.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex02_lti_four_fir.png -------------------------------------------------------------------------------- /examples/html/ex02_lti_four_fir_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex02_lti_four_fir_01.png -------------------------------------------------------------------------------- /examples/html/ex02_lti_four_fir_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex02_lti_four_fir_02.png -------------------------------------------------------------------------------- /examples/html/ex02_lti_four_fir_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex02_lti_four_fir_03.png -------------------------------------------------------------------------------- /examples/html/ex02_lti_four_fir_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex02_lti_four_fir_04.png -------------------------------------------------------------------------------- /examples/html/ex02_lti_four_fir_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex02_lti_four_fir_05.png -------------------------------------------------------------------------------- /examples/html/ex02_lti_four_fir_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex02_lti_four_fir_06.png -------------------------------------------------------------------------------- /examples/html/ex02_lti_four_fir_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex02_lti_four_fir_07.png -------------------------------------------------------------------------------- /examples/html/ex02_lti_four_fir_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex02_lti_four_fir_08.png -------------------------------------------------------------------------------- /examples/html/ex03_lti_duct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex03_lti_duct.png -------------------------------------------------------------------------------- /examples/html/ex03_lti_duct_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex03_lti_duct_01.png -------------------------------------------------------------------------------- /examples/html/ex03_lti_duct_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex03_lti_duct_02.png -------------------------------------------------------------------------------- /examples/html/ex03_lti_duct_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex03_lti_duct_03.png -------------------------------------------------------------------------------- /examples/html/ex03_lti_duct_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex03_lti_duct_04.png -------------------------------------------------------------------------------- /examples/html/ex03_lti_duct_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex03_lti_duct_05.png -------------------------------------------------------------------------------- /examples/html/ex03_lti_duct_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex03_lti_duct_06.png -------------------------------------------------------------------------------- /examples/html/ex04_lti_wts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex04_lti_wts.png -------------------------------------------------------------------------------- /examples/html/ex04_lti_wts_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex04_lti_wts_01.png -------------------------------------------------------------------------------- /examples/html/ex04_lti_wts_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex04_lti_wts_02.png -------------------------------------------------------------------------------- /examples/html/ex04_lti_wts_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex04_lti_wts_03.png -------------------------------------------------------------------------------- /examples/html/ex04_lti_wts_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex04_lti_wts_04.png -------------------------------------------------------------------------------- /examples/html/ex04_lti_wts_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex04_lti_wts_05.png -------------------------------------------------------------------------------- /examples/html/ex04_lti_wts_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex04_lti_wts_06.png -------------------------------------------------------------------------------- /examples/html/ex04_lti_wts_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex04_lti_wts_07.png -------------------------------------------------------------------------------- /examples/html/ex04_lti_wts_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex04_lti_wts_08.png -------------------------------------------------------------------------------- /examples/html/ex04_lti_wts_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex04_lti_wts_09.png -------------------------------------------------------------------------------- /examples/html/ex05_lti_wts_batch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex05_lti_wts_batch.png -------------------------------------------------------------------------------- /examples/html/ex05_lti_wts_batch_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex05_lti_wts_batch_01.png -------------------------------------------------------------------------------- /examples/html/ex05_lti_wts_batch_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex05_lti_wts_batch_02.png -------------------------------------------------------------------------------- /examples/html/ex05_lti_wts_batch_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex05_lti_wts_batch_03.png -------------------------------------------------------------------------------- /examples/html/ex05_lti_wts_batch_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex05_lti_wts_batch_04.png -------------------------------------------------------------------------------- /examples/html/ex05_lti_wts_batch_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex05_lti_wts_batch_05.png -------------------------------------------------------------------------------- /examples/html/ex05_lti_wts_batch_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex05_lti_wts_batch_06.png -------------------------------------------------------------------------------- /examples/html/ex05_lti_wts_batch_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex05_lti_wts_batch_07.png -------------------------------------------------------------------------------- /examples/html/ex06_lti_four_unc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex06_lti_four_unc.png -------------------------------------------------------------------------------- /examples/html/ex06_lti_four_unc_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex06_lti_four_unc_01.png -------------------------------------------------------------------------------- /examples/html/ex06_lti_four_unc_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex06_lti_four_unc_02.png -------------------------------------------------------------------------------- /examples/html/ex06_lti_four_unc_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex06_lti_four_unc_03.png -------------------------------------------------------------------------------- /examples/html/ex06_lti_four_unc_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex06_lti_four_unc_04.png -------------------------------------------------------------------------------- /examples/html/ex06_lti_four_unc_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex06_lti_four_unc_05.png -------------------------------------------------------------------------------- /examples/html/ex06_lti_wts_unc.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Example 6: Uncertainty bounds on estimation using first-order estimation of PBSIDopt

Example 6: Uncertainty bounds on estimation using first-order estimation of PBSIDopt

close all; clear; clc;
66 | 
-------------------------------------------------------------------------------- /examples/html/ex07_lti_wts_mcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex07_lti_wts_mcs.png -------------------------------------------------------------------------------- /examples/html/ex07_lti_wts_mcs_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex07_lti_wts_mcs_01.png -------------------------------------------------------------------------------- /examples/html/ex07_lti_wts_mcs_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex07_lti_wts_mcs_02.png -------------------------------------------------------------------------------- /examples/html/ex08_lti_wts_bootstrap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex08_lti_wts_bootstrap.png -------------------------------------------------------------------------------- /examples/html/ex08_lti_wts_bootstrap_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex08_lti_wts_bootstrap_01.png -------------------------------------------------------------------------------- /examples/html/ex08_lti_wts_bootstrap_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex08_lti_wts_bootstrap_02.png -------------------------------------------------------------------------------- /examples/html/ex09_lti_plus_periodic_rotor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex09_lti_plus_periodic_rotor.png -------------------------------------------------------------------------------- /examples/html/ex09_lti_plus_periodic_rotor_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex09_lti_plus_periodic_rotor_01.png -------------------------------------------------------------------------------- /examples/html/ex09_lti_plus_periodic_rotor_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex09_lti_plus_periodic_rotor_02.png -------------------------------------------------------------------------------- /examples/html/ex09_lti_plus_periodic_rotor_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex09_lti_plus_periodic_rotor_03.png -------------------------------------------------------------------------------- /examples/html/ex09_lti_plus_periodic_rotor_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex09_lti_plus_periodic_rotor_04.png -------------------------------------------------------------------------------- /examples/html/ex10_rlti_fast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex10_rlti_fast.png -------------------------------------------------------------------------------- /examples/html/ex10_rlti_fast_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex10_rlti_fast_01.png -------------------------------------------------------------------------------- /examples/html/ex11_rlti_slow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex11_rlti_slow.png -------------------------------------------------------------------------------- /examples/html/ex11_rlti_slow_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex11_rlti_slow_01.png -------------------------------------------------------------------------------- /examples/html/ex12_rlti_fast_closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex12_rlti_fast_closed.png -------------------------------------------------------------------------------- /examples/html/ex12_rlti_fast_closed_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex12_rlti_fast_closed_01.png -------------------------------------------------------------------------------- /examples/html/ex13_rlti_slow_closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex13_rlti_slow_closed.png -------------------------------------------------------------------------------- /examples/html/ex13_rlti_slow_closed_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex13_rlti_slow_closed_01.png -------------------------------------------------------------------------------- /examples/html/ex14_hamm_four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex14_hamm_four.png -------------------------------------------------------------------------------- /examples/html/ex14_hamm_four_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex14_hamm_four_01.png -------------------------------------------------------------------------------- /examples/html/ex14_hamm_four_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex14_hamm_four_02.png -------------------------------------------------------------------------------- /examples/html/ex14_hamm_four_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex14_hamm_four_03.png -------------------------------------------------------------------------------- /examples/html/ex14_hamm_four_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex14_hamm_four_04.png -------------------------------------------------------------------------------- /examples/html/ex15_wiener_four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex15_wiener_four.png -------------------------------------------------------------------------------- /examples/html/ex15_wiener_four_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex15_wiener_four_01.png -------------------------------------------------------------------------------- /examples/html/ex15_wiener_four_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex15_wiener_four_02.png -------------------------------------------------------------------------------- /examples/html/ex15_wiener_four_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex15_wiener_four_03.png -------------------------------------------------------------------------------- /examples/html/ex15_wiener_four_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex15_wiener_four_04.png -------------------------------------------------------------------------------- /examples/html/ex16_hammwiener_four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex16_hammwiener_four.png -------------------------------------------------------------------------------- /examples/html/ex16_hammwiener_four_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex16_hammwiener_four_01.png -------------------------------------------------------------------------------- /examples/html/ex16_hammwiener_four_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex16_hammwiener_four_02.png -------------------------------------------------------------------------------- /examples/html/ex16_hammwiener_four_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex16_hammwiener_four_03.png -------------------------------------------------------------------------------- /examples/html/ex16_hammwiener_four_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/html/ex16_hammwiener_four_04.png -------------------------------------------------------------------------------- /examples/smartrotor370.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/smartrotor370.mat -------------------------------------------------------------------------------- /examples/smartrotor430.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/examples/smartrotor430.mat -------------------------------------------------------------------------------- /examples/temp: -------------------------------------------------------------------------------- 1 | temp 2 | -------------------------------------------------------------------------------- /extra/backwards/Juang, Linear System Identification via Backward-time observer models.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/Juang, Linear System Identification via Backward-time observer models.pdf -------------------------------------------------------------------------------- /extra/backwards/dmodx.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/dmodx.m -------------------------------------------------------------------------------- /extra/backwards/dordvarx_back.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/dordvarx_back.m -------------------------------------------------------------------------------- /extra/backwards/html/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/Thumbs.db -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct_01.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct_02.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct_03.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct_04.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct_05.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct_06.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct_varmax.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct_varmax.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct_varmax_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct_varmax_01.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct_varmax_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct_varmax_02.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct_varmax_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct_varmax_03.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct_varmax_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct_varmax_04.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct_varmax_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct_varmax_05.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_duct_varmax_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_duct_varmax_06.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_01.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_02.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_03.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_04.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_05.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_06.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_07.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_08.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_varmax.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_varmax.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_varmax_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_varmax_01.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_varmax_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_varmax_02.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_varmax_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_varmax_03.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_varmax_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_varmax_04.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_varmax_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_varmax_05.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_varmax_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_varmax_06.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_varmax_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_varmax_07.png -------------------------------------------------------------------------------- /extra/backwards/html/ex_lti_four_varmax_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/backwards/html/ex_lti_four_varmax_08.png -------------------------------------------------------------------------------- /extra/backwards/private/kernregress.m: -------------------------------------------------------------------------------- 1 | function A = kernregress(Y,Z,reg,opt) 2 | %REGRESS Matrix regression with regularisation 3 | % X = REGRESS(Y,P) solves the least squares regression problem. The inputs 4 | % are the matrices Y and P, which have the same number of columns. Output 5 | % is the least squares estimate X. 6 | % 7 | % X = REGRESS(Y,P,REG,OPT) solves the regularized least squares problem. 8 | % The additional inputs are the regularization method and selection 9 | % parameters: REG = {'NONE', 'TIKH', TSVD'} and OPT = {'GCV', 'LCURVE'}. 10 | % With regularisation, the solver can better deal with singular covariance 11 | % matrices. (default REG='NONE' and OPT='GCV') 12 | % 13 | % See also LSCCA. 14 | 15 | % Ivo Houtzager 16 | % 17 | % Delft Center of Systems and Control 18 | % The Netherlands, 2009 19 | 20 | if nargin < 4 || isempty(opt) 21 | opt = 'gcv'; 22 | end 23 | if nargin < 3 || isempty(reg) 24 | reg = 'none'; 25 | end 26 | 27 | % center the variables 28 | %X = X - repmat(mean(X,1), rx, 1); 29 | %Y = Y - repmat(mean(Y,1), ry, 1); 30 | 31 | if strcmpi(reg,'none') 32 | A = Y*pinv(Z); 33 | elseif strcmpi(reg,'tikh') 34 | [V,s] = eig(Z); 35 | s = abs(diag(s)); 36 | [s,I] = sort(s,'descend'); 37 | V = real(V(:,I)); 38 | 39 | if strcmpi(opt,'lcurve') 40 | reg_min = reglcurve(Y',V,s); 41 | elseif strcmpi(opt,'gcv') 42 | reg_min = reggcv(Y',V,s); 43 | end 44 | A = (V*(diag(s./(s.^2 + reg_min^2)))*V'*Y')'; 45 | elseif strcmpi(reg,'tsvd') 46 | [V,s] = eig(Z); 47 | s = abs(diag(s)); 48 | [s,I] = sort(s,'descend'); 49 | V = real(V(:,I)); 50 | 51 | if strcmpi(opt,'lcurve') 52 | k_min = reglcurve(Y',V,s,'tsvd'); 53 | elseif strcmpi(opt,'gcv') 54 | k_min = reggcv(Y',V,s,'tsvd'); 55 | end 56 | A = (V(:,1:k_min)*diag(1./s(1:k_min))*V(:,1:k_min)'*Y')'; 57 | end 58 | 59 | 60 | -------------------------------------------------------------------------------- /extra/greybox/Reynders SYSID.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/Reynders SYSID.pdf -------------------------------------------------------------------------------- /extra/greybox/dmodx_grey.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/dmodx_grey.m -------------------------------------------------------------------------------- /extra/greybox/dordvarx_grey.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/dordvarx_grey.m -------------------------------------------------------------------------------- /extra/greybox/html/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/Thumbs.db -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_four_greybox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_four_greybox.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_four_greybox_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_four_greybox_01.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_four_greybox_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_four_greybox_02.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_four_greybox_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_four_greybox_03.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_four_greybox_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_four_greybox_04.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_four_greybox_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_four_greybox_05.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_four_greybox_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_four_greybox_06.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_four_greybox_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_four_greybox_07.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_four_greybox_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_four_greybox_08.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_wts_greybox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_wts_greybox.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_wts_greybox_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_wts_greybox_01.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_wts_greybox_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_wts_greybox_02.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_wts_greybox_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_wts_greybox_03.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_wts_greybox_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_wts_greybox_04.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_wts_greybox_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_wts_greybox_05.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_wts_greybox_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_wts_greybox_06.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_wts_greybox_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_wts_greybox_07.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_wts_greybox_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_wts_greybox_08.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_wts_greybox_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_wts_greybox_09.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_wts_greybox_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_wts_greybox_10.png -------------------------------------------------------------------------------- /extra/greybox/html/ex_lti_wts_greybox_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/extra/greybox/html/ex_lti_wts_greybox_11.png -------------------------------------------------------------------------------- /fit.m: -------------------------------------------------------------------------------- 1 | function v = fit(y,y_est) 2 | %FIT Model fit [%] 3 | % V = FIT(Y,Yest) computes the percentage of the model fit (FIT) between 4 | % the two signals Y and Yest. The FIT is calculated as: 5 | % 6 | % ||y-y_est||_2 7 | % v = max( 1 - ----------------- , 0 ) * 100% 8 | % ||y - mean(y)||_2 9 | % 10 | % The FIT of two signals that are the same is 100%. If they differ, the 11 | % FIT will be lower. When Y and Yest have multiple columns, the FIT is 12 | % calculated for every column in Y and Yest. The FIT is often used to 13 | % verify the correctness of a stable model, by comparing the real output 14 | % with the estimated output of the stable model. 15 | % 16 | % See also VAF, PEC. 17 | 18 | % Ivo Houtzager 19 | % Delft Center of Systems and Control 20 | % Delft University of Technology 21 | % The Netherlands, 2010 22 | 23 | % check input arguments 24 | if nargin < 2 25 | error('FIT requires two input arguments!'); 26 | end 27 | 28 | % check dimensions of inputs 29 | if size(y,2) > size(y,1) 30 | y = y'; 31 | end 32 | if size(y_est,2) > size(y_est,1) 33 | y_est = y_est'; 34 | end 35 | N = size(y,1); 36 | if size(y_est,1) ~= N 37 | error('Both signals should have an equal number of samples.'); 38 | end 39 | if size(y,2) ~= size(y_est,2) 40 | error('Both signals should have an equal number of components.'); 41 | end 42 | 43 | % calculate the model fit 44 | v = zeros(size(y,2),1); 45 | for i = 1:size(y,2) 46 | v(i) = max(diag(100*(1-norm(y(:,i)-y_est(:,i))./norm(y(:,i)-ones(size(y(:,i),1),1)*mean(y(:,i))))),0); 47 | end 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /helpindex.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Predictor-based Subspace Identification Toolbox 5 | -------------------------------------------------------------------------------- /helptoc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Predictor-based Subspace Identification 6 | 7 | Installation 9 | 10 | Examples 12 | 13 | Functions -- By Category 15 | 16 | Functions -- Alphabetical List 18 | 19 | Release Notes 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /hmodx.m: -------------------------------------------------------------------------------- 1 | function x = hmodx(X,n) 2 | %HMODX Closed-loop Hammerstein system identification using the PBSIDopt method. 3 | % x=hmodx(X,n) estimates the state sequence x of the identifiable system 4 | % with order n. The order n can be determined from the singular values 5 | % given by hordvarx. The matrix X is also calculated by hordvarx. 6 | % 7 | % See also: hordvarx, hx2abcdk.m, and hx2abck.m. 8 | % 9 | % References: 10 | % [1] J.W. van Wingerden, and M. Verhaegen, ``Closed loop 11 | % identification of MIMO Hammerstein models using LS-SVM'', 15th IFAC 12 | % Symposium on System Identification, Saint-Malo, France, July 6-8, 2009 13 | 14 | % Ivo Houtzager 15 | % Delft Center of Systems and Control 16 | % Delft University of Technology 17 | % The Netherlands, 2010 18 | 19 | % check number of arguments 20 | if nargin < 2 21 | error('HMODX requires at least two input arguments.'); 22 | end 23 | 24 | % cheack the dimensions of the inputs 25 | mx = size(X,1); 26 | if (n < 1) || isempty(n) 27 | error('System order of zero or lower does not make sense!') 28 | end 29 | if mx < n 30 | error('The number of rows of matrix X must be equal or higher then the order n.') 31 | end 32 | 33 | x = X(1:n,:); 34 | 35 | % scale the state sequence 36 | %x = diag(1./sqrt(var(x,0,2)))*x; 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /hwmodx.m: -------------------------------------------------------------------------------- 1 | function x = hwmodx(X,n) 2 | %HWMODX Closed-loop Hammerstein-Wiener system identification using the PBSIDopt method. 3 | % x=hwmodx(X,n) estimates the state sequence x of the identifiable system 4 | % with order n. The order n can be determined from the singular values 5 | % given by hwordvarx. The matrix X is also calculated by hwordvarx. 6 | % 7 | % See also: hwordvarx, hwx2abcdk.m, and hwx2abck.m. 8 | % 9 | % References: 10 | % [1] J.W. van Wingerden, and M. Verhaegen, ``Closed-loop subspace 11 | % identification of Hammerstein-Wiener models'', Joint 48th IEEE 12 | % Conference on Decision and Control and 28th Chinese Control Conference 13 | % Shanghai, P.R. China, December 16-18, 2009. 14 | 15 | % Ivo Houtzager 16 | % Delft Center of Systems and Control 17 | % Delft University of Technology 18 | % The Netherlands, 2010 19 | 20 | % check number of arguments 21 | if nargin < 2 22 | error('HWMODX requires at least two input arguments.'); 23 | end 24 | 25 | % cheack the dimensions of the inputs 26 | mx = size(X,1); 27 | if (n < 1) || isempty(n) 28 | error('System order of zero or lower does not make sense!') 29 | end 30 | if mx < n 31 | error('The number of rows of matrix X must be equal or higher then the order n.') 32 | end 33 | 34 | x = X(1:n,:); 35 | 36 | % scale the state sequence 37 | %x = diag(1./sqrt(var(x,0,2)))*x; 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /idss2idafflpvA.m: -------------------------------------------------------------------------------- 1 | function [sys] = idss2idafflpvA(sys,m) 2 | %IDAFFLPV/IDSS2IDAFFLPVA Convert single IDSS model to IDAFFLPV (constant A) model 3 | % [M] = IDSS2IDAFFLPVA(M,p) converts single IDSS model to IDAFFLPV model M 4 | % (with constant A). Usefull for discretization of LPV models with 5 | % constant A. 6 | 7 | % determine lpv system sizes 8 | n = size(sys.a,1); 9 | [l,r] = size(sys); 10 | l = l/(m+1); 11 | r = r/(m+1); 12 | 13 | % get system matrices 14 | [A,B,C,D,K,X0] = ssdata(sys); 15 | Ts = sys.Ts; 16 | Name = sys.Name; 17 | X0 = sys.x0; 18 | lambda = sys.NoiseVariance; 19 | InputName = sys.InputName{1:r}; 20 | OutputName = sys.OutputName{1:l}; 21 | StateName = sys.StateName; 22 | for i = 1:m 23 | StateName = [StateName; sys.StateName]; 24 | end 25 | 26 | % allocate cells 27 | Alpv = [A zeros(n,m*n)]; 28 | Blpv = B; 29 | Klpv = K; 30 | Clpv = zeros(l,n*(m+1)); 31 | Dlpv = zeros(l,r*(m+1)); 32 | 33 | % construct ss models 34 | for j = 1:(m+1) 35 | Clpv(:,(j-1)*n+1:j*n) = C((j-1)*l+1:j*l,:); 36 | Dlpv(:,(j-1)*r+1:j*r) = D((j-1)*l+1:j*l,(j-1)*r+1:j*r); 37 | end 38 | sys = idafflpv(Alpv,Blpv,Clpv,Dlpv,Klpv,X0,Ts,'Name',Name,'InputName',InputName,'OutputName',OutputName,'StateName',StateName); 39 | sys.x0 = X0; 40 | sys.NoiseVariance = lambda(1:l,1:l); -------------------------------------------------------------------------------- /info.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | R2009b 7 | Predictor-Based Subspace IDentification 8 | toolbox 9 | $toolbox/matlab/icons/unknownicon.gif 10 | . 11 | 12 | 13 | 14 | 15 | doc pbsidtoolbox 16 | $toolbox/matlab/icons/book_mat.gif 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /lmodx.m: -------------------------------------------------------------------------------- 1 | function x = lmodx(X,n) 2 | %LMODX Closed-loop LPV system identification using the PBSIDopt method. 3 | % x=lmodx(X,n) estimates the state sequence x of the identifiable system 4 | % with order n. The order n can be determined from the singular values 5 | % given by lordvarx. The matrix X is also calculated by hordvarx. 6 | % 7 | % See also: lordvarx, lx2abcdk.m, and lx2abck.m. 8 | % 9 | % References: 10 | % [1] J.W. van Wingerden, and M. Verhaegen, ``Subspace identification 11 | % of Bilinear and LPV systems for open- and closed-loop data'', 12 | % Automatica 45, pp 372--381, 2009. 13 | 14 | % Ivo Houtzager 15 | % Delft Center of Systems and Control 16 | % Delft University of Technology 17 | % The Netherlands, 2010 18 | 19 | % check number of arguments 20 | if nargin < 2 21 | error('LMODX requires at least two input arguments.'); 22 | end 23 | 24 | % cheack the dimensions of the inputs 25 | mx = size(X,1); 26 | if (n < 1) || isempty(n) 27 | error('System order of zero or lower does not make sense!') 28 | end 29 | if mx < n 30 | error('The number of rows of matrix X must be equal or higher then the order n.') 31 | end 32 | 33 | x = X(1:n,:); 34 | 35 | % scale the state sequence 36 | %x = diag(1./sqrt(var(x,0,2)))*x; 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /pbsid_product_page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Predictor-Based Subspace IDentification Toolbox 5 | 7 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 69 | 70 |
29 | 30 | 31 | 32 |
33 |
34 | 35 | Predictor-Based Subspace IDentification Toolbox (Version 0.5, Released on: 13-Jan-2012)
36 |
37 |
38 | 39 |
    40 | 41 |
  • Installation
    42 | Installation procedure for the toolbox and the menu.

  • 43 | 44 |
  • Examples
    45 | Introduces the Predictor-based Subspace Identification Toolbox and gets you started using it.

  • 46 | 47 |
  • Functions: 48 |
  • 52 | 53 |
  • Release Notes
    54 | Summarizes new features, bug fixes, upgrade issues, etc.

  • 55 | 56 |
57 | 58 |
59 |
60 | Originally developed by Ivo Houtzager 61 |

62 | 63 | Maintained by Pieter Gebraad
64 | Delft Center of Systems and Control
65 | Delft University of Technology
66 | p.m.o.gebraad@tudelft.nl
67 |
68 |

71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /pbsidsetup.m: -------------------------------------------------------------------------------- 1 | % Add current directory to the current search path 2 | addpath(pwd); 3 | disp('PBSIDToolbox succesfully added to current search path.') 4 | 5 | % Add current directory to the startup path 6 | status = savepath; 7 | if status == 1 8 | warning('pbsidsetup:AddToPathdefFailed',['Could not add PBSIDToolbox to the MATLAB search path defaults. Try to add the toolbox path (',pwd,') manually to pathdef.m.']) 9 | else 10 | disp('PBSIDToolbox succesfully added to MATLAB search path defaults.') 11 | end 12 | 13 | compilation_ok = 1; 14 | % compile functions 15 | try 16 | disp('Compiling lpvitr...') 17 | mex('-O','@idafflpv/private/lpvitr.c'); 18 | system('move lpvitr.* @idafflpv/private/'); 19 | catch exception 20 | compilation_ok = 0; 21 | disp('Could not compile @idafflpv/private/lpvitr.c'); 22 | disp('You can still use the slower ".m" version.'); 23 | disp(['Compilation error: ',exception.message]); 24 | end 25 | 26 | try 27 | disp('Compiling sfun_rttime...') 28 | mex('-O','simulink/sfun_rttime.c'); 29 | system('move sfun_rttime.* simulink/'); 30 | catch exception 31 | compilation_ok = 0; 32 | disp('Could not compile simulink/sfun_rttime.c'); 33 | disp(['Compilation error: ',exception.message]); 34 | end 35 | 36 | % compile functions SPGL1 37 | try 38 | disp('Compiling SPGL1 oneProjector to enable BPDN regularization...') 39 | mex private/spgl1oneProjector/oneProjectorMex.c private/spgl1oneProjector/oneProjectorCore.c private/spgl1oneProjector/heap.c -output private/oneProjectorMex -DNDEBUG 40 | catch exception 41 | compilation_ok = 0; 42 | disp('Could not compile oneProjector.'); 43 | disp('You can still use the slower ".m" version.'); 44 | disp(['Compilation error: ',exception.message]); 45 | end 46 | if compilation_ok 47 | disp('Compilation of mex files was succesful.') 48 | disp('PBSID setup completed'); 49 | else 50 | disp('PBSID setup completed, but without compilation of MEX-files, resulting in slow algorithms.'); 51 | disp('If the compiler was missing, please install one (e.g. the free Visual Studio C++ for Windows), and rerun the PBSID setup.'); 52 | end 53 | -------------------------------------------------------------------------------- /pec.m: -------------------------------------------------------------------------------- 1 | function v = pec(y,y_est) 2 | %PEC Prediction error cost 3 | % V = PEC(Y,Yest) computes the percentage of the model fit (FIT) between 4 | % the two signals Y and Yest. The FIT is calculated as: 5 | % 6 | % v = 1/sqrt(N) * ||y - y_est||_2 7 | % 8 | % The PEC of two signals that are the same is 0. If they differ, the 9 | % PEC will be higher. When Y and Yest have multiple columns, the PEC is 10 | % calculated for every column in Y and Yest. The PEC is often used to 11 | % verify the correctness of a model, by comparing the real output 12 | % with the estimated output of the model. 13 | % 14 | % See also VAF, FIT. 15 | 16 | % Ivo Houtzager 17 | % Delft Center of Systems and Control 18 | % Delft University of Technology 19 | % The Netherlands, 2010 20 | 21 | % check input arguments 22 | if nargin < 2 23 | error('PEC requires two input arguments!'); 24 | end 25 | 26 | % check dimensions of inputs 27 | if size(y,2) > size(y,1) 28 | y = y'; 29 | end 30 | if size(y_est,2) > size(y_est,1) 31 | y_est = y_est'; 32 | end 33 | N = size(y,1); 34 | if size(y_est,1) ~= N 35 | error('Both signals should have an equal number of samples.'); 36 | end 37 | if size(y,2) ~= size(y_est,2) 38 | error('Both signals should have an equal number of components.'); 39 | end 40 | 41 | % compute prediction error cost 42 | v = zeros(size(y,2),1); 43 | for i = 1:size(y,2) 44 | v(i) = norm(y(:,i) - y_est(:,i))./sqrt(N); 45 | end 46 | -------------------------------------------------------------------------------- /pmodx.m: -------------------------------------------------------------------------------- 1 | function [X,CC,vx,vy] = pmodx(X,TT,K,n,vx,vy) 2 | %PMODX Periodic LPV system identification using the PBSIDopt method. 3 | % [X,CC] = pmodx(X,UM,K,n) estimates the state sequence X of the 4 | % identifiable system with order n. The order n can be determined from the 5 | % correlation coefficients C given by dordopt. The matrices UM and K are 6 | % also calculated by pordvarx. 7 | % 8 | % [X,CC] = pmodx(X,UM,K,n,vx,vy) specifies the regularized parameters vx 9 | % and vy for the regularized canonical correlation analysis solver. For vx 10 | % > 0 and vy > 0, the solver can better deal with ill-conditioned 11 | % covariance matrices. To use the k-fold cross validation to calculate the 12 | % regularized parameter with best score, choose the vector vx as for 13 | % example vx = logspace(-8,-2). For vectors with lengths larger the two, 14 | % the code automatically uses cross validation. (default vx=0 and vy=0) 15 | % 16 | % [X,CC,vxm,vym] = pmodx(X,UM,K,n,vx,vy) also returns the best regularized 17 | % parameter found by the k-fold cross validation. 18 | % 19 | % References: 20 | % [1] van Wingerden, J.W., Houtzager, I., Verhaegen, M., Closed-loop 21 | % identification of the time-varying dynamics of variable-speed wind 22 | % turbines, Int. J. Robust Nonlinear Control 2008 23 | % 24 | % See also: pordxarx, px2abcdk, and px2abck.m. 25 | 26 | % Ivo Houtzager 27 | % Delft Center of Systems and Control 28 | % Delft University of Technology 29 | % The Netherlands, 2010 30 | 31 | % check number of arguments 32 | if nargin < 3 33 | error('PMODX requires at least three input arguments.'); 34 | end 35 | 36 | % cheack the dimensions of the inputs 37 | if (n < 1) || isempty(n) 38 | error('System order of zero or lower does not make sense!') 39 | end 40 | 41 | % allocate matrices 42 | j = size(X,1); 43 | fl = size(TT{1},1); 44 | UM = zeros(j*fl,j*n); 45 | for q = 1:j 46 | UM((q-1)*fl+1:q*fl,(q-1)*n+1:q*n) = TT{q,1}(:,1:n); 47 | end 48 | clear TT; 49 | 50 | % solve intersection problem 51 | if (length(vx) > 1) || (length(vy) > 1) 52 | [vx,vy] = kfcv(UM,K,q,vx,vy); 53 | end 54 | [CC,TU] = rcca(UM,K,vx,vy); 55 | 56 | % obtain the state sequence using the transformation matrix 57 | TU = TU(1:j*n,1:n); 58 | for q = 1:j 59 | X{q,1} = TU((q-1)*n+1:n*q,:)\X{q,1}(1:n,:); 60 | end 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /private/NormGroupL2_dual.m: -------------------------------------------------------------------------------- 1 | function d = NormGroupL2_dual(groups,x,weights) 2 | 3 | if isreal(x) 4 | d = norm(sqrt(sum(groups * x.^2,2))./weights,inf); 5 | else 6 | d = norm(sqrt(sum(groups * abs(x).^2,2))./weights,inf); 7 | end 8 | -------------------------------------------------------------------------------- /private/NormGroupL2_primal.m: -------------------------------------------------------------------------------- 1 | function p = NormGroupL2_primal(groups,x,weights) 2 | 3 | if isreal(x) 4 | p = sum(weights.*sqrt(sum(groups * x.^2,2))); 5 | else 6 | p = sum(weights.*sqrt(sum(groups * abs(x).^2,2))); 7 | end 8 | -------------------------------------------------------------------------------- /private/NormGroupL2_project.m: -------------------------------------------------------------------------------- 1 | function x = NormGroupL2_project(groups,x,weights,tau) 2 | % Projection binary group matrix 3 | 4 | % Compute two-norms of rows 5 | if isreal(x) 6 | xa = sqrt(sum(groups * x.^2,2)); 7 | else 8 | xa = sqrt(sum(groups * abs(x).^2,2)); 9 | end 10 | 11 | % Project one one-norm ball 12 | idx = xa < eps; 13 | xc = oneProjector(xa,weights,tau); 14 | 15 | % Scale original 16 | xc = xc ./ xa; xc(idx) = 0; 17 | x = full(groups' * xc).*x; 18 | -------------------------------------------------------------------------------- /private/NormL12_dual.m: -------------------------------------------------------------------------------- 1 | function d = NormL12_dual(g,x,weights) 2 | 3 | m = round(length(x) / g); n = g; 4 | 5 | if isreal(x) 6 | d = norm(sqrt(sum(reshape(x,m,n).^2,2))./weights,inf); 7 | else 8 | d = norm(sqrt(sum(abs(reshape(x,m,n)).^2,2))./weights,inf); 9 | end 10 | 11 | 12 | -------------------------------------------------------------------------------- /private/NormL12_primal.m: -------------------------------------------------------------------------------- 1 | function p = NormL12_primal(g,x,weights) 2 | 3 | m = round(length(x) / g); n = g; 4 | 5 | if isreal(x) 6 | p = sum(weights.*sqrt(sum(reshape(x,m,n).^2,2))); 7 | else 8 | p = sum(weights.*sqrt(sum(abs(reshape(x,m,n)).^2,2))); 9 | end 10 | -------------------------------------------------------------------------------- /private/NormL12_project.m: -------------------------------------------------------------------------------- 1 | function x = NormL12_project(g,x,weights,tau) 2 | % Projection with number of groups equal to g 3 | 4 | % Convert to matrix 5 | m = round(length(x) / g); n = g; 6 | x = reshape(x,m,n); 7 | 8 | % Compute two-norms of rows 9 | if isreal(x) 10 | xa = sqrt(sum(x.^2,2)); 11 | else 12 | xa = sqrt(sum(abs(x).^2,2)); 13 | end 14 | 15 | % Project one one-norm ball 16 | idx = xa < eps; 17 | xc = oneProjector(xa,weights,tau); 18 | 19 | % Scale original 20 | xc = xc ./ xa; xc(idx) = 0; 21 | x = spdiags(xc,0,m,m)*x; 22 | 23 | % Vectorize result 24 | x = x(:); 25 | -------------------------------------------------------------------------------- /private/NormL1_dual.m: -------------------------------------------------------------------------------- 1 | function d = NormL1_dual(x,weights) 2 | 3 | d = norm(x./weights,inf); 4 | -------------------------------------------------------------------------------- /private/NormL1_primal.m: -------------------------------------------------------------------------------- 1 | function p = NormL1_primal(x,weights) 2 | 3 | p = norm(x.*weights,1); 4 | -------------------------------------------------------------------------------- /private/NormL1_project.m: -------------------------------------------------------------------------------- 1 | function x = NormL1_project(x,weights,tau) 2 | 3 | if isreal(x) 4 | x = oneProjector(x,weights,tau); 5 | else 6 | xa = abs(x); 7 | idx = xa < eps; 8 | xc = oneProjector(xa,weights,tau); 9 | xc = xc ./ xa; xc(idx) = 0; 10 | x = x .* xc; 11 | end 12 | -------------------------------------------------------------------------------- /private/allcomb.m: -------------------------------------------------------------------------------- 1 | function B = allcomb(A) 2 | %% all combinations of columns in A 3 | 4 | [ni,nm] = size(A); 5 | ii = ni:-1:1; 6 | A = mat2cell(A, ones(1,ni), nm); 7 | % flip using ii if last column is changing fastest 8 | [B{ii}] = ndgrid(A{ii}) ; 9 | % concatenate 10 | B = reshape(cat(ni+1,B{:}),[],ni)'; 11 | end -------------------------------------------------------------------------------- /private/dpkalm.m: -------------------------------------------------------------------------------- 1 | function [K,S,E] = dpkalm(A,C,Q,R,S,F,N) 2 | %DPKALM Dynamic programming of Kalman design for a discrete state-space system. 3 | % [K,P,E] = DPKALM(A,C,Q,R,S,F,N) calculates the optimal gain matrices 4 | % K[n] such that: 5 | % 6 | % For a discrete-time state-space model SYS, u[n] = -K[n]x[n] minimizes 7 | % 8 | % J = 0.5*Sum {x[n]'Qx[n] + u[n]'Ru[n] + x[n]'Su[n]} + 0.5*x[-1]'Fx[-1] 9 | % 10 | % subject to x[n+1] = Ax[n] + Bu[n] with n = 0...N-1. 11 | % 12 | % Also returned are the the solution S of the associated algebraic 13 | % Riccati equation and the closed-loop eigenvalues E = EIG(A-K*C). 14 | 15 | % Ivo Houtzager 16 | % Delft Center of Systems and Control 17 | % Delft University of Technology 18 | % The Netherlands, 2010 19 | 20 | % check number of input arguments 21 | if nargin ~=7 22 | error('DPKALM requires at least five or six input arguments') 23 | end 24 | if ndims(A) > 2; 25 | array = 2; 26 | else 27 | array = 1; 28 | end 29 | 30 | % check dimensions and symmetry 31 | [nax ns nna] = size(A); 32 | [ncx nc nnc] = size(C); 33 | [nqx nq nnq] = size(Q); 34 | [nfx nf nnf] = size(F); 35 | [nrx nr nnr] = size(R); 36 | if ~isequal(nna,nnc,nnq,nnr,N); 37 | if array == 2 38 | error('The number of arrays have to be equal to N.'); 39 | end 40 | end 41 | if ~isequal(nc,ns); 42 | error('The A and C matrices must have the same number of columns.') 43 | end 44 | if ~isequal(nqx,nax,nfx,ns,nq,nf); 45 | error('The A, Q and F matrices must be the same size.') 46 | end 47 | if ~isequal(nrx,nr,ncx); 48 | error('The R matrix must be square with as many rows as C.') 49 | end 50 | if ~isreal(Q) || ~isreal(R) 51 | error('The weight matrices Q, R must be real valued.') 52 | end 53 | 54 | % backwards iteration 55 | K = zeros(nb,ns,N); 56 | E = zeros(ns,N); 57 | X = zeros(ns,ns,N+1); 58 | X(:,:,1) = F; 59 | switch array 60 | case 1 61 | for t = 1:N 62 | K(:,:,t) = (R + C*X(:,:,t)*C')\(C*X(:,:,t)*A' + S'); 63 | X(:,:,t+1) = (A - K(:,:,t)*C(:,:,t))*X(:,:,t)*(A - K(:,:,t)*C(:,:,t))' + K(:,:,t)'*R*K(:,:,t) + Q; 64 | if nargout >= 2 65 | E(:,t) = eig(A - K(:,:,t)*C); 66 | end 67 | end 68 | case 2 69 | for t = 1:N 70 | K(:,:,t) = (R(:,:,t) + C(:,:,t)*X(:,:,t)*C(:,:,t)')\(C(:,:,t)*X(:,:,t+1)*A(:,:,t)' + S(:,:,t)'); 71 | X(:,:,t+1) = (A(:,:,t) - K(:,:,t)*C(:,:,t))*X(:,:,t)*(A(:,:,t) - K(:,:,t)*C(:,:,t))' + K(:,:,t)'*R(:,:,t)*K(:,:,t) + Q(:,:,t); 72 | if nargout >= 2 73 | E(:,t) = eig(A(:,:,t) - K(:,:,t)*C(:,:,t)); 74 | end 75 | end 76 | end 77 | 78 | -------------------------------------------------------------------------------- /private/dplqr.m: -------------------------------------------------------------------------------- 1 | function [K,S,E] = dplqr(A,B,Q,R,F,N) 2 | %DPLQR Dynamic programming of LQR design for a discrete state-space system. 3 | % [K,S,E] = DPLQR(A,B,Q,R,F,N) calculates the optimal gain matrices K[n] 4 | % such that: 5 | % 6 | % For a discrete-time state-space model SYS, u[n] = -K[n]x[n] minimizes 7 | % 8 | % J = 0.5*Sum {x[n]'Qx[n] + u[n]'Ru[n]} + 0.5*x[N]'Fx[N] 9 | % 10 | % subject to x[n+1] = Ax[n] + Bu[n] with n = 0...N-1. 11 | % 12 | % Also returned are the the solution S of the associated algebraic 13 | % Riccati equation and the closed-loop eigenvalues E = EIG(A-B*K). 14 | 15 | % Ivo Houtzager 16 | % Delft Center of Systems and Control 17 | % Delft University of Technology 18 | % The Netherlands, 2010 19 | 20 | % check number of input arguments 21 | if nargin < 5 22 | error('DPLQR requires at least five or six input arguments') 23 | end 24 | if ndims(A) > 2; 25 | array = 2; 26 | else 27 | array = 1; 28 | end 29 | 30 | % check dimensions and symmetry 31 | [nax ns nna] = size(A); 32 | [nbx nb nnb] = size(B); 33 | [nqx nq nnq] = size(Q); 34 | [nfx nf nnf] = size(F); 35 | [nrx nr nnr] = size(R); 36 | if ~isequal(nna,nnb,nnq,nnr,N); 37 | if array == 2 38 | error('The number of arrays have to be equal to N.'); 39 | end 40 | end 41 | if ~isequal(nbx,nax); 42 | error('The A and B matrices must have the same number of rows.') 43 | end 44 | if ~isequal(nqx,nax,nfx,ns,nq,nf); 45 | error('The A, Q and F matrices must be the same size.') 46 | end 47 | if ~isequal(nrx,nr,nb); 48 | error('The R matrix must be square with as many columns as B.') 49 | end 50 | if ~isreal(Q) || ~isreal(R) 51 | error('The weight matrices Q, R must be real valued.') 52 | end 53 | 54 | % backwards iteration 55 | K = zeros(nb,ns,N); 56 | E = zeros(ns,N); 57 | S = zeros(ns,ns,N); 58 | S(:,:,N+1) = F; 59 | switch array 60 | case 1 61 | for t = N:-1:1 62 | K(:,:,t) = (R + B'*S(:,:,t+1)*B)\B'*S(:,:,t+1)*A; 63 | S(:,:,t) = (A - B*K(:,:,t))'*S(:,:,t+1)*(A - B*K(:,:,t)) + K(:,:,t)'*R*K(:,:,t) + Q; 64 | if nargout >= 2 65 | E(:,t) = eig(A - B*K(:,:,t)); 66 | end 67 | end 68 | case 2 69 | for t = N:-1:1 70 | K(:,:,t) = (R(:,:,t) + B(:,:,t)'*S(:,:,t+1)*B(:,:,t))\B(:,:,t)'*S(:,:,t+1)*A(:,:,t); 71 | S(:,:,t) = (A(:,:,t) - B(:,:,t)*K(:,:,t))'*S(:,:,t+1)*(A(:,:,t) - B(:,:,t)*K(:,:,t)) + K(:,:,t)'*R(:,:,t)*K(:,:,t) + Q(:,:,t); 72 | if nargout >= 2 73 | E(:,t) = eig(A(:,:,t) - B(:,:,t)*K(:,:,t)); 74 | end 75 | end 76 | end 77 | 78 | -------------------------------------------------------------------------------- /private/ensure.m: -------------------------------------------------------------------------------- 1 | function ensure(condition) 2 | 3 | % ensure.m 4 | % $Id: ensure.m 800 2008-02-26 22:32:04Z mpf $ 5 | % 6 | % ---------------------------------------------------------------------- 7 | % This file is part of SPGL1 (Spectral Projected Gradient for L1). 8 | % 9 | % Copyright (C) 2007 Ewout van den Berg and Michael P. Friedlander, 10 | % Department of Computer Science, University of British Columbia, Canada. 11 | % All rights reserved. E-mail: <{ewout78,mpf}@cs.ubc.ca>. 12 | % 13 | % SPGL1 is free software; you can redistribute it and/or modify it 14 | % under the terms of the GNU Lesser General Public License as 15 | % published by the Free Software Foundation; either version 2.1 of the 16 | % License, or (at your option) any later version. 17 | % 18 | % SPGL1 is distributed in the hope that it will be useful, but WITHOUT 19 | % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 20 | % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 21 | % Public License for more details. 22 | % 23 | % You should have received a copy of the GNU Lesser General Public 24 | % License along with SPGL1; if not, write to the Free Software 25 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 26 | % USA 27 | % ---------------------------------------------------------------------- 28 | 29 | if ~condition 30 | [ST,I] = dbstack; 31 | msg = 'Assertion failed'; 32 | if length(ST) > 1 33 | msg = sprintf('%s in %s; function %s line %d', ... 34 | msg, ST(2).file, ST(2).name, ST(2).line); 35 | end 36 | 37 | errstr.message = msg; 38 | error(errstr); 39 | end 40 | 41 | end % function ensure 42 | -------------------------------------------------------------------------------- /private/khatrirao.m: -------------------------------------------------------------------------------- 1 | function P = khatrirao(varargin) 2 | %KHATRIRAO Khatri-Rao product of matrices. 3 | % KHATRIRAO(A,B) computes the Khatri-Rao product of matrices A and 4 | % B that have the same number of columns. The result is the 5 | % column-wise Kronecker product 6 | % [KRON(A(:,1),B(:,1)) ... KRON(A(:,n),B(:,n))] 7 | % 8 | % KHATRIRAO(A1,A2,...) computes the Khatri-Rao product of 9 | % multiple matrices that have the same number of columns. 10 | % 11 | % KHATRIRAO(C) computes the Khatri-Rao product of 12 | % the matrices in cell array C. 13 | % 14 | % KHATRIRAO(...,'r') computes the Khatri-Rao product in reverse 15 | % order. 16 | % 17 | % Examples 18 | % A = rand(5,2); B = rand(3,2); C = rand(2,2); 19 | % khatrirao(A,B) %<-- Khatri-Rao of A and B 20 | % khatrirao(B,A,'r') %<-- same thing as above 21 | % khatrirao({C,B,A}) %<-- passing a cell array 22 | % khatrirao({A,B,C},'r') %<-- same as above 23 | % 24 | % See also TENSOR, KTENSOR. 25 | 26 | % MATLAB Tensor Toolbox. 27 | % Copyright 2009, Sandia Corporation. 28 | 29 | %% Error checking on input and set matrix order 30 | % Note that this next if/else check forces A to be a cell array. 31 | if ischar(varargin{end}) && varargin{end} == 'r' 32 | if nargin == 2 && iscell(varargin{1}) 33 | % Input is a single cell array 34 | A = varargin{1}; 35 | else 36 | % Input is a sequence of matrices 37 | A = {varargin{1:end-1}}; 38 | end 39 | matorder = length(A):-1:1; 40 | else 41 | if nargin == 1 && iscell(varargin{1}) 42 | % Input is a single cell array 43 | A = varargin{1}; 44 | else 45 | % Input is a sequence of matrices 46 | A = varargin; 47 | end 48 | matorder = 1:length(A); 49 | end 50 | 51 | %% Error check on matrices and compute number of rows in result 52 | 53 | % N = number of columns (must be the same for every input) 54 | N = size(A{1},2); 55 | 56 | % After loop, M = number of rows in the result 57 | M = 1; 58 | 59 | for i = matorder 60 | if ndims(A) ~= 2 61 | error('Each argument must be a matrix'); 62 | end 63 | if (N ~= size(A{i},2)) 64 | error('All matrices must have the same number of columns.') 65 | end 66 | M = M * size(A{i},1); 67 | end 68 | 69 | %% Computation 70 | 71 | % Preallocate 72 | P = zeros(M,N); 73 | 74 | % Loop through all the columns 75 | for n = 1:N 76 | % Loop through all the matrices 77 | ab = A{matorder(1)}(:,n); 78 | for i = matorder(2:end) 79 | % Compute outer product of nth columns 80 | ab = A{i}(:,n) * ab(:).'; 81 | end 82 | % Fill nth column of P with reshaped result 83 | P(:,n) = ab(:); 84 | end 85 | 86 | -------------------------------------------------------------------------------- /private/kpinv.m: -------------------------------------------------------------------------------- 1 | function X = kpinv(A,B,varargin) 2 | %KPINV Pseudoinverse of Kronecker product. 3 | % X=KPINV(A,B) produces a matrix X of the same dimensions as KRON(A',B') 4 | % so that KRON(A,B)*X*KRON(A,B)=KRON(A,B), X*KRON(A,B)*X=X and KRON(A,B)*X 5 | % and X*KRON(A,B) are Hermitian. The computation is based on A=U1*S1*V1' 6 | % and B=U2*S2*V2', because KRON(A,B)=KRON(U2,U2)*KRON(S1,S2)*KRON(V1,V2)'. 7 | % Any singular values less than a tolerance are treated as zero. The 8 | % default tolerances are MAX(SIZE(KRON(A,B)))*EPS(class(A)). 9 | % 10 | % KPINV(A,B,TOL) uses the tolerance TOL instead of the default. 11 | % 12 | % See also PINV. 13 | 14 | % Revised version of PINV for kronecker products, is faster and needs less 15 | % memory especially when large matrices are being used. 16 | 17 | % Ivo Houtzager 18 | % Delft Center of Systems and Control 19 | % Delft University of Technology 20 | % The Netherlands, 2010 21 | 22 | % sizes 23 | [m1,n1] = size(A); 24 | [m2,n2] = size(B); 25 | m = m1*m2; 26 | n = n1*n2; 27 | 28 | % quick return if matrices are empty 29 | if isempty(A) 30 | X = zeros(n,m,class(A)); 31 | return 32 | end 33 | 34 | if n > m 35 | X = kpinv(A',B',varargin{:})'; 36 | else 37 | [U1,S1,V1] = svd(A,0); 38 | [U2,S2,V2] = svd(B,0); 39 | 40 | if m > 1, 41 | s1 = diag(S1); 42 | s2 = diag(S2); 43 | s = kron(s1,s2); 44 | elseif m == 1, 45 | s1 = S1(1); 46 | s2 = S2(1); 47 | s = s1*s2; 48 | else 49 | s1 = 0; 50 | s2 = 0; 51 | s = 0; 52 | end 53 | 54 | if nargin == 3 55 | tol1 = varargin{1}; 56 | tol2 = tol1; 57 | else 58 | tol1 = max(m1,n1)*eps(max(s1)); 59 | tol2 = max(m2,n2)*eps(max(s2)); 60 | end 61 | 62 | r1 = sum(s1 > tol1); 63 | r2 = sum(s2 > tol2); 64 | r = r1*r2; 65 | if (r == 0) 66 | X = zeros(n,m,class(A)); 67 | else 68 | s = diag(ones(r,1)./s(1:r)); 69 | X = kron(V1(:,1:r1),V2(:,1:r2))*s*kron(U1(:,1:r1)',U2(:,1:r2)'); 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /private/logx.m: -------------------------------------------------------------------------------- 1 | function logx 2 | %LOGX Turn the X axis to LOG 3 | % LOGX turns the X axis of the current plot to log coordinates. 4 | % 5 | % See also LINX, LINY, LOGY. 6 | 7 | set(gca,'XScale','log'); 8 | end -------------------------------------------------------------------------------- /private/nuclear.m: -------------------------------------------------------------------------------- 1 | function X = nuclear(Y,Z,reg_min,tol,maxit,X0) 2 | %NUCLEAR Matrix regression with nuclear norm optimisation 3 | % X=NUCLEAR(Y,Z,reg_min) solves the least squares regression problem with 4 | % nuclear norm regularisation. The inputs are the matrices Y and Z, which 5 | % have the same number of columns. Output is the least squares estimate X. 6 | % 7 | % X=NUCLEAR(Y,Z,reg_min,tol) specifies the tolerance of the nonsmooth 8 | % gradient method. If tol is [] then NUCLEAR uses the default, 1e-4. 9 | % 10 | % X=NUCLEAR(Y,Z,reg_min,tol,maxit) specifies the maximum number of 11 | % iterations. If MAXIT is [] then NUCLEAR uses the default, 200. Warning 12 | % is given when the maximum iterations is reached. 13 | % 14 | % X=NUCLEAR(Y,Z,reg_min,tol,maxit,X0) specifies the initial least squares 15 | % estimate X. 16 | 17 | % Ivo Houtzager 18 | % Delft Center of Systems and Control 19 | % Delft University of Technology 20 | % The Netherlands, 2010 21 | 22 | % assign default values to unspecified parameters 23 | if (nargin < 6) || isempty(X0) 24 | X0 = Y*pinv(Z); 25 | end 26 | if (nargin < 5) || isempty(maxit) 27 | maxit = 200; 28 | end 29 | if (nargin < 4) || isempty(tol) 30 | tol = 1e-4; 31 | end 32 | 33 | % do the nonsmooth gradient iterations 34 | lambda = 1; 35 | N = length(Y); 36 | X = X0; 37 | ok = true; 38 | k = 1; 39 | cost1 = 1e10; 40 | while ok == true && k <= maxit 41 | % evaluate function 42 | E = Y - X*Z; 43 | cost = norm(E','fro')^2 + reg_min^2*sum(svd(X)); 44 | 45 | % check residue 46 | if abs(cost1 - cost) <= tol^2*N 47 | ok = false; 48 | end 49 | 50 | % recalculate gradient step 51 | k = k + 1; 52 | lambda = fminbnd(@(x) (norm((Y-(X + x.*(E*Z'))*Z)','fro')^2 + reg_min^2*sum(svd(X + x.*(E*Z'))))/N,0,lambda); 53 | 54 | % step update with tresholding 55 | X = X + lambda.*(E*Z'); 56 | [U,S,V] = svd(X); 57 | if size(Y,1) == 1 58 | X = U*diag(max(S(1,1)-reg_min^2*lambda,0))*V(:,1)'; 59 | else 60 | X = U*diag(max(diag(S)-reg_min^2*lambda,0))*V(:,1:length(diag(S)))'; 61 | end 62 | 63 | % swap 64 | cost1 = cost; 65 | end -------------------------------------------------------------------------------- /private/oneProjectorMex.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/private/oneProjectorMex.mexw64 -------------------------------------------------------------------------------- /private/spg_bp.m: -------------------------------------------------------------------------------- 1 | function [x,r,g,info] = spg_bp(A,b,options ) 2 | %SPG_BP Solve the basis pursuit (BP) problem 3 | % 4 | % SPG_BP is designed to solve the basis pursuit problem 5 | % 6 | % (BP) minimize ||X||_1 subject to AX = B, 7 | % 8 | % where A is an M-by-N matrix, B is an M-vector, and SIGMA is a 9 | % nonnegative scalar. In all cases below, A can be an explicit M-by-N 10 | % matrix or matrix-like object for which the operations A*x and A'*y 11 | % are defined (i.e., matrix-vector multiplication with A and its 12 | % adjoint.) 13 | % 14 | % Also, A can be a function handle that points to a function with the 15 | % signature 16 | % 17 | % v = A(w,mode) which returns v = A *w if mode == 1; 18 | % v = A'*w if mode == 2. 19 | % 20 | % X = SPG_BP(A,B) solves the BP problem. 21 | % 22 | % X = SPG_BP(A,B,OPTIONS) specifies options that are set using 23 | % SPGSETPARMS. 24 | % 25 | % [X,R,G,INFO] = SPG_BP(A,B,OPTIONS) additionally returns the 26 | % residual R = B - A*X (which should be small), the objective gradient G 27 | % = A'*R, and an INFO structure. (See SPGL1 for a description of this 28 | % last output argument.) 29 | % 30 | % See also spgl1, spgSetParms, spg_bpdn, spg_lasso. 31 | 32 | % Copyright 2008, Ewout van den Berg and Michael P. Friedlander 33 | % http://www.cs.ubc.ca/labs/scl/spgl1 34 | % $Id: spg_bp.m 1074 2008-08-19 05:24:28Z ewout78 $ 35 | 36 | if ~exist('options','var'), options = []; end 37 | if ~exist('b','var') || isempty(b) 38 | error('Second argument cannot be empty.'); 39 | end 40 | if ~exist('A','var') || isempty(A) 41 | error('First argument cannot be empty.'); 42 | end 43 | 44 | sigma = 0; 45 | tau = 0; 46 | x0 = []; 47 | [x,r,g,info] = spgl1(A,b,tau,sigma,x0,options); 48 | -------------------------------------------------------------------------------- /private/spg_bpdn.m: -------------------------------------------------------------------------------- 1 | function [x,r,g,info] = spg_bpdn( A, b, sigma, options ) 2 | %SPG_BPDN Solve the basis pursuit denoise (BPDN) problem 3 | % 4 | % SPG_BPDN is designed to solve the basis pursuit denoise problem 5 | % 6 | % (BPDN) minimize ||X||_1 subject to ||A X - B|| <= SIGMA, 7 | % 8 | % where A is an M-by-N matrix, B is an M-vector, and SIGMA is a 9 | % nonnegative scalar. In all cases below, A can be an explicit M-by-N 10 | % matrix or matrix-like object for which the operations A*x and A'*y 11 | % are defined (i.e., matrix-vector multiplication with A and its 12 | % adjoint.) 13 | % 14 | % Also, A can be a function handle that points to a function with the 15 | % signature 16 | % 17 | % v = A(w,mode) which returns v = A *w if mode == 1; 18 | % v = A'*w if mode == 2. 19 | % 20 | % X = SPG_BPDN(A,B,SIGMA) solves the BPDN problem. If SIGMA=0 or 21 | % SIGMA=[], then the basis pursuit (BP) problem is solved; i.e., the 22 | % constraints in the BPDN problem are taken as AX=B. 23 | % 24 | % X = SPG_BPDN(A,B,SIGMA,OPTIONS) specifies options that are set using 25 | % SPGSETPARMS. 26 | % 27 | % [X,R,G,INFO] = SPG_BPDN(A,B,SIGMA,OPTIONS) additionally returns the 28 | % residual R = B - A*X, the objective gradient G = A'*R, and an INFO 29 | % structure. (See SPGL1 for a description of this last output argument.) 30 | % 31 | % See also spgl1, spgSetParms, spg_bp, spg_lasso. 32 | 33 | % Copyright 2008, Ewout van den Berg and Michael P. Friedlander 34 | % http://www.cs.ubc.ca/labs/scl/spgl1 35 | % $Id: spg_bpdn.m 1074 2008-08-19 05:24:28Z ewout78 $ 36 | 37 | if ~exist('options','var'), options = []; end 38 | if ~exist('sigma','var'), sigma = []; end 39 | if ~exist('b','var') || isempty(b) 40 | error('Second argument cannot be empty.'); 41 | end 42 | if ~exist('A','var') || isempty(A) 43 | error('First argument cannot be empty.'); 44 | end 45 | 46 | tau = 0; 47 | x0 = []; 48 | [x,r,g,info] = spgl1(A,b,tau,sigma,x0,options); 49 | -------------------------------------------------------------------------------- /private/spg_lasso.m: -------------------------------------------------------------------------------- 1 | function [x,r,g,info] = spg_lasso(A,b,tau,options ) 2 | %SPG_LASSO Solve the LASSO problem 3 | % 4 | % SPG_LASSO is designed to solve the LASSO problem 5 | % 6 | % (LASSO) minimize ||AX - B||_2 subject to ||X||_1 <= tau, 7 | % 8 | % where A is an M-by-N matrix, B is an M-vector, and TAU is a 9 | % nonnegative scalar. In all cases below, A can be an explicit M-by-N 10 | % matrix or matrix-like object for which the operations A*x and A'*y 11 | % are defined (i.e., matrix-vector multiplication with A and its 12 | % adjoint.) 13 | % 14 | % Also, A can be a function handle that points to a function with the 15 | % signature 16 | % 17 | % v = A(w,mode) which returns v = A *w if mode == 1; 18 | % v = A'*w if mode == 2. 19 | % 20 | % X = SPG_LASSO(A,B,TAU) solves the LASSO problem. 21 | % 22 | % X = SPG_LASSO(A,B,TAU,OPTIONS) specifies options that are set using 23 | % SPGSETPARMS. 24 | % 25 | % [X,R,G,INFO] = SPG_LASSO(A,B,TAU,OPTIONS) additionally returns the 26 | % residual R = B - A*X, the objective gradient G = A'*R, and an INFO 27 | % structure. (See SPGL1 for a description of this last output argument.) 28 | % 29 | % See also spgl1, spgSetParms, spg_bp, spg_bpdn. 30 | 31 | % Copyright 2008, Ewout van den Berg and Michael P. Friedlander 32 | % http://www.cs.ubc.ca/labs/scl/spgl1 33 | % $Id: spg_lasso.m 1074 2008-08-19 05:24:28Z ewout78 $ 34 | 35 | if ~exist('options','var'), options = []; end 36 | if ~exist('tau','var'), tau = []; end 37 | if ~exist('b','var') || isempty(b) 38 | error('Second argument cannot be empty.'); 39 | end 40 | if ~exist('A','var') || isempty(A) 41 | error('First argument cannot be empty.'); 42 | end 43 | 44 | sigma = []; 45 | x0 = []; 46 | [x,r,g,info] = spgl1(A,b,tau,sigma,x0,options); 47 | -------------------------------------------------------------------------------- /private/spgl1oneProjector/oneProjectorCore.h: -------------------------------------------------------------------------------- 1 | /* oneProjectorCore.h 2 | $Id $ 3 | 4 | ---------------------------------------------------------------------- 5 | This file is part of SPGL1 (Spectral Projected Gradient for L1). 6 | 7 | Copyright (C) 2007 Ewout van den Berg and Michael P. Friedlander, 8 | Department of Computer Science, University of British Columbia, Canada. 9 | All rights reserved. E-mail: <{ewout78,mpf}@cs.ubc.ca>. 10 | 11 | SPGL1 is free software; you can redistribute it and/or modify it 12 | under the terms of the GNU Lesser General Public License as 13 | published by the Free Software Foundation; either version 2.1 of the 14 | License, or (at your option) any later version. 15 | 16 | SPGL1 is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 18 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 19 | Public License for more details. 20 | 21 | You should have received a copy of the GNU Lesser General Public 22 | License along with SPGL1; if not, write to the Free Software 23 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 24 | USA 25 | ---------------------------------------------------------------------- 26 | */ 27 | #ifndef __ONEPROJECTORCORE_H__ 28 | #define __ONEPROJECTORCORE_H__ 29 | 30 | /* The entries in b are non-negative, those in d strictly positive */ 31 | int projectI( double xPtr[], double bPtr[], double tau, int n ); 32 | int projectD( double xPtr[], double bPtr[], double dPtr[], double dOrg[], double tau, int n ); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /pschedclust.m: -------------------------------------------------------------------------------- 1 | function pind = pschedclust(mu,f,p,tol1,tol2) 2 | %PSCHEDCLUST Periodic clustering of scheduling sequence 3 | % pind=pschedclust(mu,f,p,tol1,tol2) clusters the (quasi) scheduling sequence 4 | % mu for periodic repetitions of p sized windows. It is intended as a 5 | % preprocessor for pordvarx. The algortihm uses a divide and conqeur 6 | % approach for sorting the p windowed vectors. After sorting the vectors 7 | % are bined in group up to a tolerance tol. 8 | % 9 | % See also: pordvarx, pmodx, px2abck, px2abcdk. 10 | 11 | % Ivo Houtzager 12 | % Delft Center of Systems and Control 13 | % Delft University of Technology 14 | % The Netherlands, 2010 15 | 16 | % assign default values to unspecified parameters 17 | if (nargin < 5) || isempty(tol2) 18 | tol1 = 1e-3; 19 | end 20 | if (nargin < 5) || isempty(tol1) 21 | tol2 = 1e-3; 22 | end 23 | 24 | % check dimensions of inputs 25 | if size(mu,2) < size(mu,1) 26 | mu = mu'; 27 | end 28 | N = size(mu,2); 29 | s = size(mu,1); 30 | 31 | % check the size of the windows 32 | if f > p 33 | error('Future window size f must equal or smaller then past window p. (f <= p)') 34 | end 35 | 36 | % clustering of scheduling periods 37 | k = 0; 38 | pvec = []; 39 | MU = zeros((p+f)*s,N-p-f+1); 40 | for i = 1:N-p-f+1 41 | d = mu(:,i:i+p+f-1); 42 | MU(:,i) = d(:); 43 | end 44 | 45 | % cluster by divide and conquer 46 | msum = sum(MU,1)./(p+f); 47 | for i = 1:N-p-f+1 48 | if isempty(pvec) || ~any(pvec == i) 49 | k = k + 1; 50 | pvec = [pvec i]; 51 | pind{k,1} = i; 52 | mind = find((msum >= (msum(i) - tol1)) & (msum <= (msum(i) + tol1))); 53 | for j = 1:length(mind) 54 | if i ~= mind(j) && ~any(pvec == mind(j)) 55 | if norm(MU(:,i) - MU(:,mind(j)))/sqrt(p+f) <= tol2 56 | pvec = [pvec mind(j)]; 57 | pind{k,1} = [pind{k,1} mind(j)]; 58 | end 59 | end 60 | end 61 | end 62 | end 63 | MU = []; 64 | end 65 | 66 | -------------------------------------------------------------------------------- /sigscale.m: -------------------------------------------------------------------------------- 1 | function [us,Du,ys,Dy,zs,Dz] = sigscale(u,y,z) 2 | %SIGSCALE Scaling of Identifications Signals 3 | % [US,DU,YS,DY]=SIGSCALE(U,Y) scales the input and output signals U and 4 | % Y, such that the returned signal have the variance VAR(US)=1 and 5 | % VAR(YS)=1. The scaling matrices DU and DY can be used to convert the 6 | % amplitudes back to original size Y=DY*YS and U=DU*US. The original 7 | % state-space system is obtained from the identified system as follows: 8 | % 9 | % x(k+1) = A x(k) + B/Du u(k) 10 | % y(k) = Dy*C x(k) + Dy*D/Du u(k) 11 | 12 | % Ivo Houtzager 13 | % Delft Center of Systems and Control 14 | % Delft University of Technology 15 | % The Netherlands, 2010 16 | 17 | % check number if input arguments 18 | if nargin < 2 19 | error('SIGSCALE requires two input arguments.') 20 | end 21 | 22 | % check dimensions of inputs 23 | if size(y,2) < size(y,1) 24 | y = y'; 25 | end 26 | if size(u,2) < size(u,1) 27 | u = u'; 28 | end 29 | % N = size(y,2); 30 | % if ~isequal(N,length(u)) 31 | % error('The number of rows of vectors/matrices u and y must be the same.') 32 | % end 33 | 34 | Dy = diag(sqrt(var(y,0,2))); % output scaling matrix 35 | ys = diag(1./diag(Dy))*y; % scaling 36 | 37 | Du = diag(sqrt(var(u,0,2))); % input scaling matrix 38 | us = diag(1./diag(Du))*u; % scaling 39 | 40 | if nargin > 2 41 | if size(z,2) < size(z,1) 42 | z = z'; 43 | end 44 | Dz = diag(sqrt(var(z,0,2))); % output scaling matrix 45 | zs = diag(1./diag(Dz))*z; % scaling 46 | end 47 | -------------------------------------------------------------------------------- /simulink/GUST2data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/GUST2data.mat -------------------------------------------------------------------------------- /simulink/GUST2weight_f10.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/GUST2weight_f10.mat -------------------------------------------------------------------------------- /simulink/GUST2weight_f5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/GUST2weight_f5.mat -------------------------------------------------------------------------------- /simulink/GUST2weight_f50.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/GUST2weight_f50.mat -------------------------------------------------------------------------------- /simulink/sfun_rttime.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/sfun_rttime.mexw64 -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/info/binfo.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/info/binfo.mat -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/info/chart5_YAcMENJsgW1dTHFHNLCtkC.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/info/chart5_YAcMENJsgW1dTHFHNLCtkC.mat -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/c5_sim1_rlti_varmax_gust2.h: -------------------------------------------------------------------------------- 1 | #ifndef __c5_sim1_rlti_varmax_gust2_h__ 2 | #define __c5_sim1_rlti_varmax_gust2_h__ 3 | 4 | /* Include files */ 5 | #include "sfc_sf.h" 6 | #include "sfc_mex.h" 7 | #include "rtwtypes.h" 8 | 9 | /* Type Definitions */ 10 | typedef struct { 11 | const char * context; 12 | const char * name; 13 | const char * dominantType; 14 | const char * resolved; 15 | uint32_T fileTimeLo; 16 | uint32_T fileTimeHi; 17 | uint32_T mFileTimeLo; 18 | uint32_T mFileTimeHi; 19 | } c5_ResolvedFunctionInfo; 20 | 21 | typedef struct { 22 | SimStruct *S; 23 | real_T c5_ABK[70]; 24 | real_T c5_CD[16]; 25 | real_T c5_Du; 26 | real_T c5_Dy[4]; 27 | real_T c5_E1[2]; 28 | real_T c5_LK[25000]; 29 | real_T c5_Pabk[100]; 30 | real_T c5_Pcd[64]; 31 | real_T c5_Plk[63504]; 32 | real_T c5_U1; 33 | real_T c5_VARX[504]; 34 | real_T c5_W[700]; 35 | real_T c5_X[7]; 36 | real_T c5_X1[7]; 37 | real_T c5_Y1[2]; 38 | real_T c5_Zp[250]; 39 | real_T c5_k; 40 | real_T c5_saw; 41 | real_T c5_start; 42 | real_T c5_w[300]; 43 | boolean_T c5_ABK_not_empty; 44 | boolean_T c5_CD_not_empty; 45 | boolean_T c5_E1_not_empty; 46 | boolean_T c5_LK_not_empty; 47 | boolean_T c5_Pabk_not_empty; 48 | boolean_T c5_Pcd_not_empty; 49 | boolean_T c5_Plk_not_empty; 50 | boolean_T c5_U1_not_empty; 51 | boolean_T c5_VARX_not_empty; 52 | boolean_T c5_X1_not_empty; 53 | boolean_T c5_X_not_empty; 54 | boolean_T c5_Y1_not_empty; 55 | boolean_T c5_Zp_not_empty; 56 | boolean_T c5_k_not_empty; 57 | boolean_T c5_saw_not_empty; 58 | boolean_T c5_start_not_empty; 59 | boolean_T c5_w_not_empty; 60 | uint8_T c5_is_active_c5_sim1_rlti_varmax_gust2; 61 | ChartInfoStruct chartInfo; 62 | } SFc5_sim1_rlti_varmax_gust2InstanceStruct; 63 | 64 | /* Named Constants */ 65 | 66 | /* Variable Declarations */ 67 | 68 | /* Variable Definitions */ 69 | 70 | /* Function Declarations */ 71 | extern const mxArray 72 | *sf_c5_sim1_rlti_varmax_gust2_get_eml_resolved_functions_info(void); 73 | 74 | /* Function Definitions */ 75 | extern void sf_c5_sim1_rlti_varmax_gust2_get_check_sum(mxArray *plhs[]); 76 | extern void c5_sim1_rlti_varmax_gust2_method_dispatcher(SimStruct *S, int_T 77 | method, void *data); 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/c5_sim1_rlti_varmax_gust2.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/c5_sim1_rlti_varmax_gust2.obj -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/rtwtypeschksum.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/rtwtypeschksum.mat -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.bat: -------------------------------------------------------------------------------- 1 | call "mexopts.bat" 2 | nmake -f sim1_rlti_varmax_gust2_sfun.mak 3 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.exp -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.h: -------------------------------------------------------------------------------- 1 | #ifndef __sim1_rlti_varmax_gust2_sfun_h__ 2 | #define __sim1_rlti_varmax_gust2_sfun_h__ 3 | 4 | /* Include files */ 5 | #define S_FUNCTION_NAME sf_sfun 6 | #include "sfc_sf.h" 7 | #include "sfc_mex.h" 8 | #include "rtwtypes.h" 9 | #include "sfcdebug.h" 10 | #define rtInf (mxGetInf()) 11 | #define rtMinusInf (-(mxGetInf())) 12 | #define rtNaN (mxGetNaN()) 13 | #define rtIsNaN(X) ((int)mxIsNaN(X)) 14 | #define rtIsInf(X) ((int)mxIsInf(X)) 15 | 16 | /* Type Definitions */ 17 | 18 | /* Named Constants */ 19 | #define CALL_EVENT (-1) 20 | 21 | /* Variable Declarations */ 22 | extern uint32_T _sim1_rlti_varmax_gust2MachineNumber_; 23 | extern real_T _sfTime_; 24 | 25 | /* Variable Definitions */ 26 | 27 | /* Function Declarations */ 28 | extern void sim1_rlti_varmax_gust2_initializer(void); 29 | extern void sim1_rlti_varmax_gust2_terminator(void); 30 | 31 | /* Function Definitions */ 32 | 33 | /* We load infoStruct for rtw_optimation_info on demand in mdlSetWorkWidths and 34 | free it immediately in mdlStart. Given that this is machine-wide as 35 | opposed to chart specific, we use NULL check to make sure it gets loaded 36 | and unloaded once per machine even though the methods mdlSetWorkWidths/mdlStart 37 | are chart/instance specific. The following methods abstract this out. */ 38 | extern mxArray* load_sim1_rlti_varmax_gust2_optimization_info(void); 39 | extern void unload_sim1_rlti_varmax_gust2_optimization_info(void); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.lib -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.mexw64.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.mol: -------------------------------------------------------------------------------- 1 | c5_sim1_rlti_varmax_gust2.obj 2 | sim1_rlti_varmax_gust2_sfun_registry.obj 3 | sim1_rlti_varmax_gust2_sfun.obj 4 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.obj -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun_registry.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun_registry.obj -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/info/binfo.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/info/binfo.mat -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/info/chart1_RldjQTVqZeaf7bPKMIG6FG.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/info/chart1_RldjQTVqZeaf7bPKMIG6FG.mat -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/info/chart1_v2EDslKQ9w9YLzGIbb0pOB.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/info/chart1_v2EDslKQ9w9YLzGIbb0pOB.mat -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/c1_sim1_rlti_varx_fast_gust2.h: -------------------------------------------------------------------------------- 1 | #ifndef __c1_sim1_rlti_varx_fast_gust2_h__ 2 | #define __c1_sim1_rlti_varx_fast_gust2_h__ 3 | 4 | /* Include files */ 5 | #include "sfc_sf.h" 6 | #include "sfc_mex.h" 7 | #include "rtwtypes.h" 8 | 9 | /* Type Definitions */ 10 | typedef struct { 11 | const char * context; 12 | const char * name; 13 | const char * dominantType; 14 | const char * resolved; 15 | uint32_T fileTimeLo; 16 | uint32_T fileTimeHi; 17 | uint32_T mFileTimeLo; 18 | uint32_T mFileTimeHi; 19 | } c1_ResolvedFunctionInfo; 20 | 21 | typedef struct { 22 | SimStruct *S; 23 | real_T c1_ABK[70]; 24 | real_T c1_CD[16]; 25 | real_T c1_Du; 26 | real_T c1_Dy[4]; 27 | real_T c1_Glk[459]; 28 | real_T c1_LK[15000]; 29 | real_T c1_Pabk[100]; 30 | real_T c1_Pcd[64]; 31 | real_T c1_Plk[1099]; 32 | real_T c1_U1; 33 | real_T c1_VARX[306]; 34 | real_T c1_VARX1[300]; 35 | real_T c1_W[700]; 36 | real_T c1_X[7]; 37 | real_T c1_X1[7]; 38 | real_T c1_Y1[2]; 39 | real_T c1_Ylk[3]; 40 | real_T c1_Z[156]; 41 | real_T c1_eta[468]; 42 | real_T c1_k; 43 | real_T c1_saw; 44 | real_T c1_start; 45 | real_T c1_w[300]; 46 | boolean_T c1_ABK_not_empty; 47 | boolean_T c1_CD_not_empty; 48 | boolean_T c1_Glk_not_empty; 49 | boolean_T c1_LK_not_empty; 50 | boolean_T c1_Pabk_not_empty; 51 | boolean_T c1_Pcd_not_empty; 52 | boolean_T c1_Plk_not_empty; 53 | boolean_T c1_U1_not_empty; 54 | boolean_T c1_VARX1_not_empty; 55 | boolean_T c1_VARX_not_empty; 56 | boolean_T c1_X1_not_empty; 57 | boolean_T c1_X_not_empty; 58 | boolean_T c1_Y1_not_empty; 59 | boolean_T c1_Ylk_not_empty; 60 | boolean_T c1_Z_not_empty; 61 | boolean_T c1_eta_not_empty; 62 | boolean_T c1_k_not_empty; 63 | boolean_T c1_saw_not_empty; 64 | boolean_T c1_start_not_empty; 65 | boolean_T c1_w_not_empty; 66 | uint8_T c1_is_active_c1_sim1_rlti_varx_fast_gust2; 67 | ChartInfoStruct chartInfo; 68 | } SFc1_sim1_rlti_varx_fast_gust2InstanceStruct; 69 | 70 | /* Named Constants */ 71 | 72 | /* Variable Declarations */ 73 | 74 | /* Variable Definitions */ 75 | 76 | /* Function Declarations */ 77 | extern const mxArray 78 | *sf_c1_sim1_rlti_varx_fast_gust2_get_eml_resolved_functions_info(void); 79 | 80 | /* Function Definitions */ 81 | extern void sf_c1_sim1_rlti_varx_fast_gust2_get_check_sum(mxArray *plhs[]); 82 | extern void c1_sim1_rlti_varx_fast_gust2_method_dispatcher(SimStruct *S, int_T 83 | method, void *data); 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/c1_sim1_rlti_varx_fast_gust2.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/c1_sim1_rlti_varx_fast_gust2.obj -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/rtwtypeschksum.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/rtwtypeschksum.mat -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.bat: -------------------------------------------------------------------------------- 1 | call "mexopts.bat" 2 | nmake -f sim1_rlti_varx_fast_gust2_sfun.mak 3 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.exp -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.h: -------------------------------------------------------------------------------- 1 | #ifndef __sim1_rlti_varx_fast_gust2_sfun_h__ 2 | #define __sim1_rlti_varx_fast_gust2_sfun_h__ 3 | 4 | /* Include files */ 5 | #define S_FUNCTION_NAME sf_sfun 6 | #include "sfc_sf.h" 7 | #include "sfc_mex.h" 8 | #include "rtwtypes.h" 9 | #include "sfcdebug.h" 10 | #define rtInf (mxGetInf()) 11 | #define rtMinusInf (-(mxGetInf())) 12 | #define rtNaN (mxGetNaN()) 13 | #define rtIsNaN(X) ((int)mxIsNaN(X)) 14 | #define rtIsInf(X) ((int)mxIsInf(X)) 15 | 16 | /* Type Definitions */ 17 | 18 | /* Named Constants */ 19 | #define CALL_EVENT (-1) 20 | 21 | /* Variable Declarations */ 22 | extern uint32_T _sim1_rlti_varx_fast_gust2MachineNumber_; 23 | extern real_T _sfTime_; 24 | 25 | /* Variable Definitions */ 26 | 27 | /* Function Declarations */ 28 | extern void sim1_rlti_varx_fast_gust2_initializer(void); 29 | extern void sim1_rlti_varx_fast_gust2_terminator(void); 30 | 31 | /* Function Definitions */ 32 | 33 | /* We load infoStruct for rtw_optimation_info on demand in mdlSetWorkWidths and 34 | free it immediately in mdlStart. Given that this is machine-wide as 35 | opposed to chart specific, we use NULL check to make sure it gets loaded 36 | and unloaded once per machine even though the methods mdlSetWorkWidths/mdlStart 37 | are chart/instance specific. The following methods abstract this out. */ 38 | extern mxArray* load_sim1_rlti_varx_fast_gust2_optimization_info(void); 39 | extern void unload_sim1_rlti_varx_fast_gust2_optimization_info(void); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.lib -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.mexw64.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.mol: -------------------------------------------------------------------------------- 1 | c1_sim1_rlti_varx_fast_gust2.obj 2 | sim1_rlti_varx_fast_gust2_sfun_registry.obj 3 | sim1_rlti_varx_fast_gust2_sfun.obj 4 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.obj -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun_registry.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun_registry.obj -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/info/binfo.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/info/binfo.mat -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/info/chart2_ABX9sv2Fuqtg24DYMjDvvF.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/info/chart2_ABX9sv2Fuqtg24DYMjDvvF.mat -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/info/chart2_sqMHCYEULCklBR6f1VisPC.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/info/chart2_sqMHCYEULCklBR6f1VisPC.mat -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/c2_sim1_rlti_varx_gust2.h: -------------------------------------------------------------------------------- 1 | #ifndef __c2_sim1_rlti_varx_gust2_h__ 2 | #define __c2_sim1_rlti_varx_gust2_h__ 3 | 4 | /* Include files */ 5 | #include "sfc_sf.h" 6 | #include "sfc_mex.h" 7 | #include "rtwtypes.h" 8 | 9 | /* Type Definitions */ 10 | typedef struct { 11 | const char * context; 12 | const char * name; 13 | const char * dominantType; 14 | const char * resolved; 15 | uint32_T fileTimeLo; 16 | uint32_T fileTimeHi; 17 | uint32_T mFileTimeLo; 18 | uint32_T mFileTimeHi; 19 | } c2_ResolvedFunctionInfo; 20 | 21 | typedef struct { 22 | SimStruct *S; 23 | real_T c2_ABK[70]; 24 | real_T c2_CD[16]; 25 | real_T c2_Du; 26 | real_T c2_Dy[4]; 27 | real_T c2_LK[15000]; 28 | real_T c2_Pabk[100]; 29 | real_T c2_Pcd[64]; 30 | real_T c2_Plk[23104]; 31 | real_T c2_U1; 32 | real_T c2_VARX[304]; 33 | real_T c2_W[700]; 34 | real_T c2_X[7]; 35 | real_T c2_X1[7]; 36 | real_T c2_Y1[2]; 37 | real_T c2_Zp[150]; 38 | real_T c2_k; 39 | real_T c2_saw; 40 | real_T c2_start; 41 | real_T c2_w[300]; 42 | boolean_T c2_ABK_not_empty; 43 | boolean_T c2_CD_not_empty; 44 | boolean_T c2_LK_not_empty; 45 | boolean_T c2_Pabk_not_empty; 46 | boolean_T c2_Pcd_not_empty; 47 | boolean_T c2_Plk_not_empty; 48 | boolean_T c2_U1_not_empty; 49 | boolean_T c2_VARX_not_empty; 50 | boolean_T c2_X1_not_empty; 51 | boolean_T c2_X_not_empty; 52 | boolean_T c2_Y1_not_empty; 53 | boolean_T c2_Zp_not_empty; 54 | boolean_T c2_k_not_empty; 55 | boolean_T c2_saw_not_empty; 56 | boolean_T c2_start_not_empty; 57 | boolean_T c2_w_not_empty; 58 | uint8_T c2_is_active_c2_sim1_rlti_varx_gust2; 59 | ChartInfoStruct chartInfo; 60 | } SFc2_sim1_rlti_varx_gust2InstanceStruct; 61 | 62 | /* Named Constants */ 63 | 64 | /* Variable Declarations */ 65 | 66 | /* Variable Definitions */ 67 | 68 | /* Function Declarations */ 69 | extern const mxArray *sf_c2_sim1_rlti_varx_gust2_get_eml_resolved_functions_info 70 | (void); 71 | 72 | /* Function Definitions */ 73 | extern void sf_c2_sim1_rlti_varx_gust2_get_check_sum(mxArray *plhs[]); 74 | extern void c2_sim1_rlti_varx_gust2_method_dispatcher(SimStruct *S, int_T method, 75 | void *data); 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/c2_sim1_rlti_varx_gust2.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/c2_sim1_rlti_varx_gust2.obj -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/rtwtypeschksum.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/rtwtypeschksum.mat -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.bat: -------------------------------------------------------------------------------- 1 | call "mexopts.bat" 2 | nmake -f sim1_rlti_varx_gust2_sfun.mak 3 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.exp -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.h: -------------------------------------------------------------------------------- 1 | #ifndef __sim1_rlti_varx_gust2_sfun_h__ 2 | #define __sim1_rlti_varx_gust2_sfun_h__ 3 | 4 | /* Include files */ 5 | #define S_FUNCTION_NAME sf_sfun 6 | #include "sfc_sf.h" 7 | #include "sfc_mex.h" 8 | #include "rtwtypes.h" 9 | #include "sfcdebug.h" 10 | #define rtInf (mxGetInf()) 11 | #define rtMinusInf (-(mxGetInf())) 12 | #define rtNaN (mxGetNaN()) 13 | #define rtIsNaN(X) ((int)mxIsNaN(X)) 14 | #define rtIsInf(X) ((int)mxIsInf(X)) 15 | 16 | /* Type Definitions */ 17 | 18 | /* Named Constants */ 19 | #define CALL_EVENT (-1) 20 | 21 | /* Variable Declarations */ 22 | extern uint32_T _sim1_rlti_varx_gust2MachineNumber_; 23 | extern real_T _sfTime_; 24 | 25 | /* Variable Definitions */ 26 | 27 | /* Function Declarations */ 28 | extern void sim1_rlti_varx_gust2_initializer(void); 29 | extern void sim1_rlti_varx_gust2_terminator(void); 30 | 31 | /* Function Definitions */ 32 | 33 | /* We load infoStruct for rtw_optimation_info on demand in mdlSetWorkWidths and 34 | free it immediately in mdlStart. Given that this is machine-wide as 35 | opposed to chart specific, we use NULL check to make sure it gets loaded 36 | and unloaded once per machine even though the methods mdlSetWorkWidths/mdlStart 37 | are chart/instance specific. The following methods abstract this out. */ 38 | extern mxArray* load_sim1_rlti_varx_gust2_optimization_info(void); 39 | extern void unload_sim1_rlti_varx_gust2_optimization_info(void); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.lib -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.mexw64.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.mol: -------------------------------------------------------------------------------- 1 | c2_sim1_rlti_varx_gust2.obj 2 | sim1_rlti_varx_gust2_sfun_registry.obj 3 | sim1_rlti_varx_gust2_sfun.obj 4 | -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.obj -------------------------------------------------------------------------------- /simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun_registry.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun_registry.obj -------------------------------------------------------------------------------- /simulink/xpc1_h2_ctrl.m: -------------------------------------------------------------------------------- 1 | % Identification of 2D Airfoil 2 | clc; clear; close all; 3 | 4 | % High frequency roll-off filter 5 | omega=10*pi*2; 6 | filter = tf([omega^2],[1 omega*2*0.5 omega^2]); 7 | 8 | % Load Data 9 | load model.mat 10 | P = ss(Mi); 11 | P = d2c(P); 12 | P = series([filter 0 0; 0 1 0; 0 0 1],P); 13 | figure, bodemag(P); 14 | figure, sigma(P); 15 | 16 | % H2 design 17 | GP = [P; 0.01 0 0]; 18 | GP = minreal(GP([1:3 1:2],[2:3 1])); 19 | [C,CL,gam,info] = h2syn(GP,2,1); 20 | gam 21 | figure, bodemag(C); 22 | figure, sigma(C); 23 | 24 | % disturbance 25 | t = (0:0.01:10)'; 26 | u1 = [5*sin(t.*4.7) 5*sin(t.*4.7)]; 27 | u2 = [5*sin(t.*17.1) 5*sin(t.*17.1+pi)]; 28 | 29 | % Rescale; 30 | H = P(1:2,2:3); 31 | P = P(1:2,1); 32 | 33 | % Closed-loop 34 | CL = feedback(P,C,+1); 35 | figure, pzmap(CL); 36 | figure, bodemag(CL); 37 | figure, sigma(CL); 38 | 39 | % Sensitivity function 40 | S = minreal(inv(eye(2) - P*C)); 41 | figure, bodemag(S); 42 | figure, sigma(S); 43 | figure, lsim(S,u1,t); 44 | figure, lsim(S,u2,t); 45 | 46 | % Noise Sensitivity function 47 | N = minreal(inv(eye(2) - P*C))*H; 48 | figure, bodemag(N,H); 49 | figure, sigma(N,H); 50 | 51 | % Input Sensitivity function 52 | I = minreal(inv(1 - C*P))*C; 53 | figure, bodemag(I); 54 | figure, sigma(I); 55 | figure, lsim(I,u1,t); 56 | figure, lsim(I,u2,t); 57 | 58 | % resample 59 | Ts = 0.005; 60 | Fs = c2d(filter,Ts,'tustin'); 61 | Cs = c2d(C,Ts,'tustin'); 62 | figure, bodemag(C*filter,Cs*Fs); 63 | 64 | % save controller 65 | save h2ctrl.mat Fs Cs 66 | 67 | % State-feedback regulator design for antiwindup 68 | O = ss(Cs.a',Cs.c',Cs.b',Cs.d',Cs.ts); 69 | Q = eye(2); 70 | R = 100; 71 | [L,S,E] = lqry(O,Q,R); 72 | L = L'; 73 | Cs = ss(Cs.a,[Cs.b L],Cs.c,[Cs.d 0],Cs.ts); 74 | 75 | % save controller 76 | save h2ctrl_aw.mat Fs Cs 77 | -------------------------------------------------------------------------------- /snr.m: -------------------------------------------------------------------------------- 1 | function s = snr(y,y0) 2 | %SNR Signal to noise ratio [dB] 3 | % S = SNR(Y,Y0) calculates the Signal to Noise Ratio (SNR) of the signals 4 | % Y and Y0, where Y is the noise corrupted output of the system and Y0 the 5 | % output of the deterministic transfer only. 6 | 7 | % Ivo Houtzager 8 | % Delft Center of Systems and Control 9 | % Delft University of Technology 10 | % The Netherlands, 2010 11 | 12 | 13 | % check input arguments 14 | if nargin ~= 2 15 | error('SNR requires two input arguments!') 16 | end 17 | 18 | % check dimensions of inputs 19 | if size(y,2) > size(y,1) 20 | y = y'; 21 | end 22 | if size(y0,2) > size(y0,1) 23 | y0 = y0'; 24 | end 25 | N = size(y,1); 26 | if size(y0,1) ~= N 27 | error('Both signals should have an equal number of samples.'); 28 | end 29 | if size(y,2) ~= size(y0,2) 30 | error('Both signals should have an equal number of components.'); 31 | end 32 | 33 | % calculate signal to noise ratio 34 | s = 10*log10(var(y)./var(y-y0)); -------------------------------------------------------------------------------- /vaf.m: -------------------------------------------------------------------------------- 1 | function v = vaf(y,y_est) 2 | %VAF Variance Accounted For [%] 3 | % V = VAF(Y,Yest) computes the percentage of the Variance Accounted For 4 | % (VAF) between the two signals Y and Yest. The VAF is calculated as: 5 | % 6 | % variance(y-y_est) 7 | % v = max( 1 - ----------------- , 0 ) * 100% 8 | % variance(y) 9 | % 10 | % The VAF of two signals that are the same is 100%. If they differ, the 11 | % VAF will be lower. When Y and Yest have multiple columns, the VAF is 12 | % calculated for every column in Y and Yest. The VAF is often used to 13 | % verify the correctness of a stable model, by comparing the real output 14 | % with the estimated output of the stable model. 15 | % 16 | % See also PEC, FIT. 17 | 18 | % Ivo Houtzager 19 | % Delft Center of Systems and Control 20 | % Delft University of Technology 21 | % The Netherlands, 2010 22 | 23 | % check input arguments 24 | if nargin < 2 25 | error('VAF requires two input arguments!'); 26 | end 27 | 28 | % check dimensions of inputs 29 | if size(y,2) > size(y,1) 30 | y = y'; 31 | end 32 | if size(y_est,2) > size(y_est,1) 33 | y_est = y_est'; 34 | end 35 | N = size(y,1); 36 | if size(y_est,1) ~= N 37 | error('Both signals should have an equal number of samples.'); 38 | end 39 | if size(y,2) ~= size(y_est,2) 40 | error('Both signals should have an equal number of components.'); 41 | end 42 | 43 | % calculate the variance accounted for 44 | v = max(diag(100*(eye(size(y,2))-cov(y-y_est)./cov(y))),0); 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /wmodx.m: -------------------------------------------------------------------------------- 1 | function x = wmodx(X,n) 2 | %WMODX Closed-loop Wiener system identification using the PBSIDopt method. 3 | % x=wmodx(X,n) estimates the state sequence x of the identifiable system 4 | % with order n. The order n can be determined from the singular values 5 | % given by wordvarx. The matrix X is also calculated by wordvarx. 6 | % 7 | % See also: wordvarx, wx2abcdk.m, and wx2abck.m. 8 | % 9 | % References: 10 | % [1] J.W. van Wingerden, and M. Verhaegen, ``Closed-loop subspace 11 | % identification of Hammerstein-Wiener models'', Joint 48th IEEE 12 | % Conference on Decision and Control and 28th Chinese Control Conference 13 | % Shanghai, P.R. China, December 16-18, 2009. 14 | 15 | % Ivo Houtzager 16 | % Delft Center of Systems and Control 17 | % Delft University of Technology 18 | % The Netherlands, 2010 19 | 20 | % check number of arguments 21 | if nargin < 2 22 | error('DMODX requires at least two input arguments.'); 23 | end 24 | 25 | % cheack the dimensions of the inputs 26 | mx = size(X,1); 27 | if (n < 1) || isempty(n) 28 | error('System order of zero or lower does not make sense!') 29 | end 30 | if mx < n 31 | error('The number of rows of matrix X must be equal or higher then the order n.') 32 | end 33 | 34 | x = X(1:n,:); 35 | 36 | % scale the state sequence 37 | %x = diag(1./sqrt(var(x,0,2)))*x; 38 | 39 | 40 | 41 | 42 | 43 | --------------------------------------------------------------------------------