
将C语言变成matlab程序
typedefstruct_tCovariance{floatPNowOpt[16];floatPPreOpt[16];}tCovariance;#defineQ11.0...
typedef struct _tCovariance
{
float PNowOpt[16];
float PPreOpt[16];
}tCovariance;
#define Q1 1.0
#define Q2 5.0
#define R1 2.0
#define R2 13.0
#define R3 0.8
#define x1init 0.01
#define x2init 0.01
#define x3init 0.01
#define x4init 0.5
static tOptimal tOpt;
static tCovariance tCov;
//float Z[3] = {0,0,0}; // 测量值(每次测量的数据需要存入该数组)
static float I[16] = {1.0, 0, 0, 0,
0 ,1.0, 0, 0,
0 , 0,1.0, 0,
0 , 0, 0, 1.0}; // 单位矩阵
static float X[4] = {0,0,0,0}; // 当前状态的预测值
static float P[16] = {1.0,0,0,0,
0,1.0,0,0,
0,0,1.0,0,
0,0,0,1.0}; // 当前状态的预测值的协方差
static float K[12] = {0,0,0,
0,0,0,
0,0,0,
0,0,0}; // 卡尔曼增益
static float Temp3[12] = {0}; // 辅助变量 展开
{
float PNowOpt[16];
float PPreOpt[16];
}tCovariance;
#define Q1 1.0
#define Q2 5.0
#define R1 2.0
#define R2 13.0
#define R3 0.8
#define x1init 0.01
#define x2init 0.01
#define x3init 0.01
#define x4init 0.5
static tOptimal tOpt;
static tCovariance tCov;
//float Z[3] = {0,0,0}; // 测量值(每次测量的数据需要存入该数组)
static float I[16] = {1.0, 0, 0, 0,
0 ,1.0, 0, 0,
0 , 0,1.0, 0,
0 , 0, 0, 1.0}; // 单位矩阵
static float X[4] = {0,0,0,0}; // 当前状态的预测值
static float P[16] = {1.0,0,0,0,
0,1.0,0,0,
0,0,1.0,0,
0,0,0,1.0}; // 当前状态的预测值的协方差
static float K[12] = {0,0,0,
0,0,0,
0,0,0,
0,0,0}; // 卡尔曼增益
static float Temp3[12] = {0}; // 辅助变量 展开
展开全部
就这么多?全是定义阿
%%%%%%%%%struct _tCovariance 结构体%%%%%%%%%
struct_tCovariance=struct('PNowOpt',[], 'PPreOpt',[]);
%%%%%%%%%% define 全改为等号%%%%%%
Q1=1.0; Q2=5.0 其他自己写
%%%%%%%
%%%%%%%%%%% static 在matlab都不用定义,直接赋值%%%%%
Z=[0 0 0];
I=[1.0, 0, 0, 0 ; 0 ,1.0, 0, 0; 0 , 0,1.0, 0; 0 , 0, 0, 1.0] %%%矩阵用分号换行
其他自己写
%%%%%%%%%struct _tCovariance 结构体%%%%%%%%%
struct_tCovariance=struct('PNowOpt',[], 'PPreOpt',[]);
%%%%%%%%%% define 全改为等号%%%%%%
Q1=1.0; Q2=5.0 其他自己写
%%%%%%%
%%%%%%%%%%% static 在matlab都不用定义,直接赋值%%%%%
Z=[0 0 0];
I=[1.0, 0, 0, 0 ; 0 ,1.0, 0, 0; 0 , 0,1.0, 0; 0 , 0, 0, 1.0] %%%矩阵用分号换行
其他自己写
追问
还有的,这不是一个完整的程序,方便把邮箱留下吗,我把源代码发过去,谢谢了
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询