view m-toolbox/test/LTPDA_training/topic5/TrainigSession_T5_Ex04.m @ 29:54f14716c721 database-connection-manager

Update Java code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% 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)