1、nb=2nc=2 ai bi cia1= -1.493742 b1= 1.000714 c1= -0.960678a2= 0.693381 b2= 0.500283 c2= 0.140650zi=1.5*zi-1-0.7*zi-2+ui-1+0.5*ui-2+ei-ei-1+0.2*ei-2其各阶相应的AIC值:AIC1= 266.721111AIC2= -555.549342(2)用仿真模型为:z(k)1.185z(k1)+0.814z(k2) 0.518z(k3)+0.349z(k4)-0.117z(k5)=1.08u(k1) 0.745u(k2)+0.475u(k3) 0.253u(k4
2、)+0.123u(k5)+e(k) e(k1)+0.2*e(k2),各阶的AIC值并不单调减少,而是有两个极小值点,后一个极小值是最小值。取AIC值的第一个极小值为阶次递推结束的判断准则时(本程序中使用),用高阶CAR模型辨识时,参数基本一致,均为五阶;再用CARMA模型辨识时,其阶次随M序列的起始位置的变化而变化,基本为二阶(与噪声模型阶次相同)。如果取最小值,即第二个极小值为阶次递推结束的判断准则,用高阶CAR模型辨识时,参数也基本一致,均为七阶。再用CARMA模型辨识时,其阶次随M序列的起始位置的变化而变化,或为二阶或为四阶。取第一个极小值时最终结果如下。1)CAR模型辨识(见数据文件s
3、ita_模型二_CAR.txt)其各阶相应的AIC最终辨识结果为:na=5nb=5a1= -0.223720 b1= 1.078827 a2= 0.413757 b2= 0.281458 a3= -0.089438 b3= 0.535125 a4= 0.133208 b4= 0.215608 a5= -0.042686 b5= 0.154680 z(k)-1.185z(k-1)+0.814z(k-2)-0.518z(k-3)+0.349z(k-4)-0.117z(k-5)=1.08u(k-1)-0.745u(k-2)+0.475u(k-3)-0.253u(k-4)+0.123u(k-5)+e(
4、k)-e(k-1)+0.2*e(k-2),AIC1= -503.448058AIC2= -512.867662AIC3= -547.163204AIC4= -574.337431AIC5= -576.0722352)CARMA模型辨识(见数据文件sita_模型二_CARMA.txt)a1= -0.311358 b1= 1.082055 c1= -0.105349a2= -0.046363 b2= 0.190831 c2= -0.508015AIC1= -500.816897AIC2= -546.201025虽然辨识参数及辨识出的阶次跟实际模型相差很大,但辨识出的模型输出却跟实际输出接近,CAR
5、模型跟CARMA模型的输出结果尤其接近。(开始运行时输出的曲线为三种输出都有的曲线。当用鼠标左键在界面内双击时,可循环显示CAR模型与CARMA模型输出曲线、CARMA模型与实际模型输出曲线、实际模型与CAR模型输出曲线及三者全部显示的曲线。)三组模型输出结果参见数据文件zzz.txt,e_CAR.txt表示CAR模型使用的白噪声与WhiteNoise2.txt相同,e_CARMA.txt表示CARMA模型使用的白噪声,由CAR模型辨识误差形成。U.txt为实际使用的M序列(Mserials.txt)的子序列(随起始位置的变化而不同),z.txt为模型输出。sita_模型、_CAR.txt和s
6、ita_模型、_CARMA.txt分别表示CAR模型和CARMA模型的辨识结果。(3)源程序/ ELS_RO_AICDlg.cpp : implementation file/#include stdafx.hELS_RO_AIC.hELS_RO_AICDlg.hmath.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif#define A 179#define PAI 3.1415926/ CAboutDlg dialog used for App Aboutclas
7、s CAboutDlg : public CDialogpublic: CAboutDlg();/ Dialog Data /AFX_DATA(CAboutDlg) enum IDD = IDD_ABOUTBOX ; /AFX_DATA / ClassWizard generated virtual function overrides /AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); / DDX/DDV support /AFX_VIRTUAL/ Implementation
8、protected: /AFX_MSG(CAboutDlg) /AFX_MSG DECLARE_MESSAGE_MAP();CAboutDlg:CAboutDlg() : CDialog(CAboutDlg:IDD) /AFX_DATA_INIT(CAboutDlg) /AFX_DATA_INITvoid CAboutDlg:DoDataExchange(CDataExchange* pDX) CDialog:DoDataExchange(pDX); /AFX_DATA_MAP(CAboutDlg) /AFX_DATA_MAPBEGIN_MESSAGE_MAP(CAboutDlg, CDial
9、og) /AFX_MSG_MAP(CAboutDlg) / No message handlers /AFX_MSG_MAPEND_MESSAGE_MAP()/ CELS_RO_AICDlg dialogCELS_RO_AICDlg:CELS_RO_AICDlg(CWnd* pParent /*=NULL*/) : CDialog(CELS_RO_AICDlg:IDD, pParent) /AFX_DATA_INIT(CELS_RO_AICDlg) m_dwnVAR = 0.1; m_dwnMEAN = 0.0; m_nwnLEN = 600; m_nmVALn = 10; m_nmLOC =
10、 103; m_nmLEN = 1023; / Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()-LoadIcon(IDR_MAINFRAME);void CELS_RO_AICDlg: /AFX_DATA_MAP(CELS_RO_AICDlg) DDX_Control(pDX, IDC_EDIT_mLOC, m_CEdit_MLOC); DDX_Control(pDX, IDC_SPIN_MLOC, m_ctrMLOC); DDX_Text(pDX, IDC_
11、EDIT_wnVAR, m_dwnVAR); DDX_Text(pDX, IDC_EDIT_wnMEAN, m_dwnMEAN); DDX_Text(pDX, IDC_EDIT_wnLEN, m_nwnLEN); DDX_Text(pDX, IDC_EDIT_mVALn, m_nmVALn); DDX_Text(pDX, IDC_EDIT_mLOC, m_nmLOC); DDX_Text(pDX, IDC_EDIT_mLEN, m_nmLEN); DDX_Control(pDX, IDC_STATIC_IDRefTEXT, m_ctrStaticIDRefText); DDX_Control(
12、pDX, IDC_STATIC_ErrTEXT, m_ctrStaticErrText); DDX_Control(pDX, IDC_STATIC_GRAPH, m_ctrStaticGraph); DDX_Control(pDX, IDC_STATIC_RefTEXT, m_ctrStaticRefText);BEGIN_MESSAGE_MAP(CELS_RO_AICDlg, CDialog) /AFX_MSG_MAP(CELS_RO_AICDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(ID
13、C_BUTTON_whitenoiseMAKE, OnBUTTONwhitenoiseMAKE) ON_BN_CLICKED(IDC_BUTTON_mSerialMAKE, OnBUTTONmSerialMAKE) ON_BN_CLICKED(IDC_BUTTON_ELS_RO_AIC, OnButtonElsRoAic) ON_EN_CHANGE(IDC_EDIT_mVALn, OnChangeEDITmVALn) ON_WM_DESTROY() ON_BN_CLICKED(IDC_RADIO_MODEL1, OnRadioModel1) ON_BN_CLICKED(IDC_RADIO_MO
14、DEL2, OnRadioModel2) ON_WM_LBUTTONDBLCLK()/ CELS_RO_AICDlg message handlersBOOL CELS_RO_AICDlg:OnInitDialog()OnInitDialog(); / Add About. menu item to system menu. / IDM_ABOUTBOX must be in the system command range. ASSERT(IDM_ABOUTBOX & 0xFFF0) = IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX AppendMenu(MF_SEP
15、ARATOR);AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); / Set the icon for this dialog. The framework does this automatically / when the applications main window is not a dialog SetIcon(m_hIcon, TRUE); / Set big icon SetIcon(m_hIcon, FALSE); / Set small icon / TODO: Add extra initialization here
16、m_ctrMLOC.SetBuddy(&m_CEdit_MLOC); m_ctrMLOC.SetRange(0,m_nmLEN-m_nwnLEN); m_tempInt=NULL; CButton * pButton = (CButton *) this-GetDlgItem(IDC_RADIO_MODEL1); pButton-SetCheck(1); model=TRUE; ZZZ=NULL; return TRUE; / return TRUE unless you set the focus to a controlOnSysCommand(UINT nID, LPARAM lPara
17、m) if (nID & 0xFFF0) = IDM_ABOUTBOX) CAboutDlg dlgAbout; dlgAbout.DoModal(); else CDialog:OnSysCommand(nID, lParam);/ If you add a minimize button to your dialog, you will need the code below/ to draw the icon. For MFC applications using the document/view model,/ this is automatically done for you b
18、y the framework.OnPaint() if (IsIconic() CPaintDC dc(this); / device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); / Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect
19、); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; / Draw the icon dc.DrawIcon(x, y, m_hIcon);OnPaint();/ The system calls this to obtain the cursor to display while the user drags/ the minimized window.HCURSOR CELS_RO_AICDlg:OnQueryDragIcon() return (HCURSOR) m_hI
20、con;OnBUTTONwhitenoiseMAKE() Add your control notification handler code here /FILE *fp1; FILE *fp2; int N=m_nwnLEN+1; int i; double *inta1,*inta2; double *x1,*x2,*y1,*y2; inta1=(double*)malloc(N*sizeof(double); inta2=(double*)malloc(N*sizeof(double); x1=(double*)malloc(N+1)*sizeof(double); x2=(doubl
21、e*)malloc(N+1)*sizeof(double); y1=(double*)malloc(N*sizeof(double); y2=(double*)malloc(N*sizeof(double); x10=11.0; x20=13.0; junyun(N-1,x2,y2); junyun(N-1,x1,y1); if(fp2=fopen(WhiteNoise2.txt,w)=NULL) MessageBox(cannot open the file :WhiteNoise2.txtn); return; for (i=0;i0) fprintf(fp2, %3.12f ,inta2
22、i); else fprintf(fp2,%3.12f if (i+1)%10)=0) fprintf(fp2,n fclose(fp2); free(inta1); free(inta2); free(x1); free(x2); free(y1); free(y2); return;junyun(int n, double x, double y) int i,b; unsigned long c; c=4294967; for (i=1;=n+1; b=(int)(A*xi-1)/c; xi=(A*xi-1)-b*c; yi-1=xi-1/c;OnBUTTONmSerialMAKE()
23、UpdateData(TRUE); FILE *fp; int i,j; int m_nAmpMserial=1; m_nmLEN=(int)pow(2,m_nmVALn)-1; UpdateData(FALSE); int *yita,*u; u=(int *)malloc(m_nmLEN*sizeof(int); yita=(int *)malloc(m_nmLEN*sizeof(int); if(fp=fopen(MSerials.txtMSerials.txtn j=0; for(i=0;m_nmVALn; yitai=1; ui=yitai*m_nAmpMserial; fprintf(fp,%3d ,ui); j+; for(i=m_nmVALn;m_nmLEN; switch( m_nmVALn ) case 2: yitai=yitai-m_nmVALnyitai-1; br
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1