在gnuplot中拟合直方图

时间:2017-01-09 11:48:00

标签: linux gnuplot histogram curve-fitting data-fitting

我正在尝试在gnuplot中拟合数据(直方图)。我尝试了各种函数,通过查看我的直方图,我认为最合适的是对数正态或伽马分布,但我无法在gnuplot中做到这一点(我是gnuplot的新用户)。

这是具有高斯分布的直方图的图片:

Histogram with gauss distribution (bad fit)

此处还有gnuplot中的代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;

namespace SERIAL_PORT
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            getavailableports();
        }
        void getavailableports()
        {
            string[] ports = SerialPort.GetPortNames();
            comboBox1.Items.AddRange(ports);

        }

        private void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (comboBox1.Text == "" || comboBox2.Text == "")
                {
                    MessageBox.Show("please select port");
                }
                else
                {
                    serialPort1.PortName = comboBox1.Text;
                    serialPort1.BaudRate = Convert.ToInt32(comboBox2.Text);
                    serialPort1.Open();
                    progressBar1.Value = 100;
                   // textBox2.Enabled = true;
                    button6.Enabled = true;
                    button7.Enabled = true;
                    textBox1.Enabled = true;

                }
            }
            catch (UnauthorizedAccessException)
            {
                MessageBox.Show("no");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            serialPort1.Close();
            progressBar1.Value = 0;
            button6.Enabled = false;
            button7.Enabled = false;
            textBox1.Enabled = false;
            //textBox2.Enabled = false;
        }

        private void button6_Click(object sender, EventArgs e)
        {
            serialPort1.WriteLine(textBox1.Text + "");
            textBox1.Text = "";
        }

        private void button7_Click(object sender, EventArgs e)
        {                 
         richTextBox1.Text = serialPort1.ReadExisting();     

        }
    }

}

在文件hist.temp中是表格输出(see this link

0 个答案:

没有答案