有人知道如何将以下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);
答案 0 :(得分: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
获取你想要的矢量......