summaryrefslogtreecommitdiff
path: root/identTime.sci
blob: c4c47c8542a0d21832f9d77a01974a01ae16b572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function varargout = identTime(varargin)
    [lhs , rhs] = argn()
	if ( rhs <> 1 ) then
		errmsg = msprintf(gettext("%s: Wrong number of input arguments"), "identTime");
		error(errmsg)
	elseif typeof(varargin(1)) <> "iddata" then
        error(msprintf(gettext("%s:Input model must be ""iddata"" type.\n"),"identTime"))
    end
    plantData = varargin(1)
    //disp('yolo')
    inputData = plantData.InputData;inputData = size(inputData,'r')
    outputData = plantData.OutputData;outputData = size(outputData,'r')
    sampleNumb = max(inputData,outputData)
    timeData = (0:sampleNumb-1)*plantData.Ts
    t = tlist(['identTime','samples','start','end','Frequency','TimeSeries'],sampleNumb,0,timeData($),1/plantData.Ts,timeData)
    varargout(1) = t
endfunction

function %identTime_p(mytlist)
    f = fieldnames(mytlist)
    mprintf("\t    samples : %d\n",mytlist.samples)
    mprintf("\t      start : %d\n",mytlist.start)
    mprintf("\t        end : %d\n",mytlist.end)
    if ceil(mytlist.Frequency)-mytlist.Frequency then
        mprintf("\t  Frequency : %.4f\n",mytlist.Frequency)
    else
        mprintf("\t  Frequency : %d\n",mytlist.Frequency)
    end
    timeData = mytlist.TimeSeries
    mprintf("\t TimeSeries : %.2f, %.2f, . ,%.2f",timeData(1),timeData(2),timeData($))
    
endfunction