2

任何人都知道如何将以下 matlab 代码创建的残差转换为向量A

我试图通过r在命令提示符下键入来获取残差,但没有得到残差

谢谢。

代码:

clc;
clear;

a0 = 0.05; a1 = 0.1; b1 = 0.85;
nu = randn(2300,1);
epsi = zeros(2300,1);
h = zeros(2300,1);

for i=2: 2300 
    h(i) = a0 + a1 * epsi(i-1)^2 + b1 * h(i-1)  ; 
    epsi(i) = nu(i) * sqrt(h(i));

end

ytlast=epsi(2300);
htlast=h(2300);

yt1 = zeros(2300,1);

for i=1: 2300 
    yt1(i) = epsi(i)*epsi(i);
end

yt=yt1(1301:2300);

order = 15;
m = arx(yt1, order);

r = resid(iddata([yt1(1:order);yt1]), m);
r = r(order+1:end);
4

1 回答 1

4

先用get看看r有什么:

get(r)
ans = 
              Domain: 'Time'
                Name: ''
          OutputData: [2315x1 double]
                   y: 'Same as OutputData'
          OutputName: {'e@y1'}
          OutputUnit: {''}
           InputData: [2315x0 double]
                   u: 'Same as InputData'
           InputName: {0x1 cell}
           InputUnit: {0x1 cell}
              Period: [0x1 double]
         InterSample: {0x1 cell}
                  Ts: 1
              Tstart: []
    SamplingInstants: [2315x0 double]
            TimeUnit: 'seconds'
      ExperimentName: 'Exp1'
               Notes: {}
            UserData: []

然后,我假设您想查看:

r.OutputData

获得你想要的向量...

于 2013-02-21T06:13:05.510 回答