diff m-toolbox/test/LTPDA_training/topic5/TrainigSession_T5_Ex04.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/test/LTPDA_training/topic5/TrainigSession_T5_Ex04.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,49 @@
+% Training session Topic 5 exercise 04
+% 
+% Fitting time series with polynimials
+% 
+% 1) Load time series noise
+% 2) Fit data with ao/polyfit
+% 3) Check results
+% 
+% 
+% L FERRAIOLI 22-02-09
+%
+% $Id: TrainigSession_T5_Ex04.m,v 1.2 2011/05/13 15:13:12 ingo Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% 1) load fsdata
+
+% load test noise AO from file
+a = ao(plist('filename', 'topic5/T5_Ex04_TestNoise.xml'));
+a.setName;
+
+% looking at data
+iplot(a)
+
+%% 2) polyfit
+
+% ao/polyfit is a wrapper of the matlab function polyfit
+
+% set plist for fit
+plfit = plist('N', 6); % set the order of the polynomial to be fitted to data
+
+% fit data
+p = polyfit(a, plfit);
+
+% evaluating model
+b = ao(plist('polyval', p, 't', a));
+
+%% 3) Check results
+
+% plot model and data
+iplot(a,b)
+
+% plotting fit residuals
+iplot(a-b)
+
+
+
+
+