Mercurial > hg > ltpda
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % Training session Topic 5 exercise 04 | |
2 % | |
3 % Fitting time series with polynimials | |
4 % | |
5 % 1) Load time series noise | |
6 % 2) Fit data with ao/polyfit | |
7 % 3) Check results | |
8 % | |
9 % | |
10 % L FERRAIOLI 22-02-09 | |
11 % | |
12 % $Id: TrainigSession_T5_Ex04.m,v 1.2 2011/05/13 15:13:12 ingo Exp $ | |
13 % | |
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
15 | |
16 %% 1) load fsdata | |
17 | |
18 % load test noise AO from file | |
19 a = ao(plist('filename', 'topic5/T5_Ex04_TestNoise.xml')); | |
20 a.setName; | |
21 | |
22 % looking at data | |
23 iplot(a) | |
24 | |
25 %% 2) polyfit | |
26 | |
27 % ao/polyfit is a wrapper of the matlab function polyfit | |
28 | |
29 % set plist for fit | |
30 plfit = plist('N', 6); % set the order of the polynomial to be fitted to data | |
31 | |
32 % fit data | |
33 p = polyfit(a, plfit); | |
34 | |
35 % evaluating model | |
36 b = ao(plist('polyval', p, 't', a)); | |
37 | |
38 %% 3) Check results | |
39 | |
40 % plot model and data | |
41 iplot(a,b) | |
42 | |
43 % plotting fit residuals | |
44 iplot(a-b) | |
45 | |
46 | |
47 | |
48 | |
49 |