diff options
Diffstat (limited to 'misdata.sci')
-rw-r--r-- | misdata.sci | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/misdata.sci b/misdata.sci index c1ced50..5bd6340 100644 --- a/misdata.sci +++ b/misdata.sci @@ -1,11 +1,37 @@ function varargout = misdata(varargin) + +// Recover Missing Data by Interpolation +// +// Calling Sequence +// data = misdata(plantData) +// Parameters +// plantData : iddata type object with missing data as Nan +// data : iddata type object with interpolated data +// +// Description +// misdata function recovers the experimental missing plant time series data by linear interpolation. +// +// Examples +// u = idinput(1024,'PRBS',[0 1/20],[-1 1]) +// a = [1 0.2];b = [0 0.2 0.3]; +// model = idpoly(a,b,'Ts',0.1) +// y = sim(u,model) + rand(length(u),1) +// u(100:105) = %nan;u(300:100:1000) = %nan +// y(420:422) = %nan;y(555:100:1024) = %nan +// plantData = iddata(y,u,0.1) +// data = misdata(plantData) +// +// Authors +// Ashutosh Kumar Bhargava, Bhushan Manjarekar + + [lhs,rhs] = argn(0) -//------------------------------------------------------------------------------ -// checking the number of inputs +// ------------------------------------------------------------------------------ +// checking the number of inputs if rhs <> 1 then error(msprintf(gettext("%s:Wrong number of input arguments.\n"),"misdata")) end -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ ioData = varargin(1) if typeof(ioData) <> "iddata" then error(msprintf(gettext("%s: Plant input data must be ""iddata"" type. "),"misdata")) @@ -16,14 +42,14 @@ function varargout = misdata(varargin) endfunction function varargout = linearINTRP(matData,Ts) - // looking for overall nan values + // looking for overall nan values nanData = isnan(matData);nanIndex = find(nanData == %T) if ~size(nanIndex,'*') then varargout(1) = matData else tempMat = [] matSize = size(matData,'r') - // looking for nan in each column + // looking for nan in each column for ii = 1:size(matData,'c') nanData = isnan(matData(:,ii));nanIndex = find(nanData == %T); if ~size(nanData,'*') then |