目前在做电机的参数辨识,运行程序之后输出的def三个数全都显示为0,不知道为什么
void RSLd()
{
const float Ts = 25e-6;
double thetae_d0[3][1] = {0,0,0};
double thetae_d1[3][1];
const float forget = 0.99; //遗忘因子
double fai_dt[1][3];//待辨识矩阵φd
double P0[3][3] = {{100,0,0},{0,100,0},{0,0,100}} ; //协方差矩阵 = alpha^2 * 三阶单位矩阵
double P1[3][3];
double Kd[3][1];
float d,e,f;
double fai_d[3][1] = {{d},{e},{f}};
int a,b;
for(a = 0; a < 3; a ++)
{
fai_dt[0][a] = fai_d[a][0];
for(b = 0; b < 3; b ++)
{
Kd[a][0] = P0[a][b] * fai_d[a][0]/(forget + fai_dt[0][a] * P0[a][b] * fai_d[b][0]);
P1[a][b] =( P0[a][b] + Kd[a][0] * fai_dt[0][a] * P0[a][b] ) / forget;
thetae_d1[a][0] = thetae_d0[a][0] + Kd[a][0] * (id1 - fai_dt[0][a] * thetae_d0[a][0]);
thetae_d0[b][0] = thetae_d1[b][0];
P0[a][b] = P1[a][b];
}
}
}