⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unitfeature.cpp

📁 模式识别程序
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "UnitFeature.h"
#include "math.h"
#include "Unit_main.h"
#include "Unitarray.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
float da[540];
TForm_Feture *Form_Feture;


//---------------------------------------------------------------------------
__fastcall TForm_Feture::TForm_Feture(TComponent* Owner)
        : TForm(Owner)
{
StringGrid_feature->Cells[0][0]="数据组";
StringGrid_feature->Cells[1][0]="平均幅值";
StringGrid_feature->Cells[2][0]="方差";
StringGrid_feature->Cells[3][0]="均方根";
StringGrid_feature->Cells[4][0]="方根幅值";
StringGrid_feature->Cells[5][0]="峰峰值";
StringGrid_feature->Cells[6][0]="波形指标";
StringGrid_feature->Cells[7][0]="标峰值因子";
StringGrid_feature->Cells[8][0]="脉冲因子";
StringGrid_feature->Cells[9][0]="裕度因子";
StringGrid_feature->Cells[10][0]="峭度因子";

for(int i=1;i<=27;i++)
{
 StringGrid_feature->Cells[0][i]="第"+IntToStr(i)+"组数据";
}
 
}
//---------------------------------------------------------------------------



void __fastcall TForm_Feture::Button1Click(TObject *Sender)
{
float data[27][20];
  for(int i=0;i<27;i++)
  {
    for(int j=0;j<20;j++)
    {
      data[i][j]=da[20*i+j];
    }
  }
   for(int i=0;i<27;i++)
   {

   feature[i][0]=Public_math->aver(data[i],20);
   feature[i][1]=Public_math->equation(data[i],20);
   feature[i][2]=Public_math->aversquare(data[i],20);
   feature[i][3]=Public_math->square_equation(data[i],20);
   feature[i][4]=Public_math->p_p(data[i],20);
   feature[i][5]=Public_math->wave_coeff(data[i],20);
   feature[i][6]=Public_math->peak_coeff(data[i],20);
   feature[i][7]=Public_math->pulse_coeff(data[i],20);
   feature[i][8]=Public_math->square_equation_coeff(data[i],20);
   feature[i][9]=Public_math->kurtosis_coeff(data[i],20);
   //feature[i][10]=Public_math->max_frequency(data[i],20);
   }
   for(int i=0;i<27;i++)
   {
    for(int j=0;j<10;j++)
     {

      StringGrid_feature->Cells[j+1][i+1] =feature[i][j];
     }
   }

}
//---------------------------------------------------------------------------

void __fastcall TForm_Feture::Button2Click(TObject *Sender)
{
  Form_array->Show();
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -