资源简介

本程序采用VS2010,C#语言编写的窗体应用程序,主要功能为卡尔曼滤波绘图,其中附加时间转换的工能,程序提供3个数据文件,在debug文件夹中,时间数据是小数年格式,所以将其转化成通用时。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Windows.Forms.DataVisualization.Charting;

namespace kalman
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.QUpDown.Value = (decimal)0.1;
            this.RUpDown.Value = (decimal)0.01;
            flag = true;
        }
        //全局变量
        public double[] xdata =null;                   //监测数据
        public double[] axis = null;                   //横轴时间
        bool flag = false;
          
        private void toolStripLabel1_Click(object sender EventArgs e)
        {
            //局部变量
            int length = 0;                            //数据长度

            //读取数据文件并选取x方向位移
            OpenFileDialog openfile = new OpenFileDialog();
            openfile.InitialDirectory = Application.StartupPath;
            openfile.FileName = ““;
            openfile.Filter = “observation(*)|*“;
            openfile.title = “请打开文件“;
            string readoh = null;
            string[] observation = null;
            try
            {
                if (openfile.ShowDialog() == DialogResult.OK)
                {
                    readoh = openfile.FileName;
                }
                observation = File.ReadAllLines(readoh Encoding.Default);
            }
            catch (Exception er)
            {
                MessageBox.Show(er.ToString());
            }            

            length = observation.Length - 1;
            xdata = new double[length];
            axis = new double[length];

            for (int i = 0; i < length; i++)
            {
                xdata[i] = Convert.ToDouble(observation[i].Substring(16 5).Trim());
                axis[i] = Convert.ToDouble(observation[i].Substring(0 15).Trim());
            }

            //进行卡尔曼滤波
            this.chart1.Visible = true;

            frash();
        }

        private void QUpDown_ValueChanged(object sender EventArgs e)
        {
            if (flag)
            {
                frash();
            }
        }

        private void RUpDown_ValueChanged(object sender EventArgs e)
        {
            if (flag)
            {
                frash();
            }
        }
        /// 
        /// 刷新
        /// 

        /// 
        /// 
        /// 
        private void frash()
        {
            kalmanf kk = new kalmanf();
            kk.Q = Convert.ToDouble(QUpDown.Value);
            kk.R = Convert.ToDouble(RUpDown.Value);
            kk.KalmanFilter(axis xdata this.chart1);
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-11-08 15:54  kalman\
     目录           0  2013-11-08 15:50  kalman\kalman\
     文件        8339  2013-11-08 15:21  kalman\kalman\Form1.Designer.cs
     文件        3020  2013-11-08 15:54  kalman\kalman\Form1.cs
     文件        6015  2013-11-08 15:21  kalman\kalman\Form1.resx
     文件         487  2013-10-26 21:11  kalman\kalman\Program.cs
     目录           0  2013-11-08 15:50  kalman\kalman\Properties\
     文件        1344  2013-10-26 21:11  kalman\kalman\Properties\AssemblyInfo.cs
     文件        2863  2013-10-26 21:11  kalman\kalman\Properties\Resources.Designer.cs
     文件        5612  2013-10-26 21:11  kalman\kalman\Properties\Resources.resx
     文件        1092  2013-10-26 21:11  kalman\kalman\Properties\Settings.Designer.cs
     文件         249  2013-10-26 21:11  kalman\kalman\Properties\Settings.settings
     文件        4260  2013-11-08 15:04  kalman\kalman\Times.cs
     目录           0  2013-11-08 15:50  kalman\kalman\bin\
     目录           0  2013-11-08 15:54  kalman\kalman\bin\Debug\
     文件       14848  2013-11-08 15:54  kalman\kalman\bin\Debug\kalman.exe
     文件       34304  2013-11-08 15:54  kalman\kalman\bin\Debug\kalman.pdb
     文件       11600  2013-11-08 15:54  kalman\kalman\bin\Debug\kalman.vshost.exe
     文件         490  2010-03-17 22:39  kalman\kalman\bin\Debug\kalman.vshost.exe.manifest
     文件       35743  2013-10-18 09:42  kalman\kalman\bin\Debug\l022_4h
     文件       44105  2010-10-20 15:12  kalman\kalman\bin\Debug\s171_4h
     文件       44104  2010-10-20 15:11  kalman\kalman\bin\Debug\s191_4h
     目录           0  2013-11-08 16:01  kalman\kalman\bin\Release\
     文件        3813  2013-11-08 14:57  kalman\kalman\kalman.csproj
     文件        3491  2013-11-08 15:07  kalman\kalman\kalmanf.cs
     目录           0  2013-11-08 15:50  kalman\kalman\obj\
     目录           0  2013-11-08 15:50  kalman\kalman\obj\x86\
     目录           0  2013-11-08 15:54  kalman\kalman\obj\x86\Debug\
     文件        5226  2013-11-08 15:50  kalman\kalman\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6289  2013-11-08 15:54  kalman\kalman\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         152  2013-11-08 15:21  kalman\kalman\obj\x86\Debug\GenerateResource.read.1.tlog
............此处省略10个文件信息

评论

共有 条评论