expression must have integral type问题求助
时间:10-02
整理:3721RD
点击:
/*
* juece.c
*
* Created on: 2015-5-16
*
*/
#include"math.h"
#define pi 3.1415
#define fs 2000//采样率
#define fc 500 //载波
#define N 128 //采样点
#define TAB_max 180
#define step_angal 0.0174532925
//希尔伯特滤波器系数
const unsigned int B[61] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 81, 0, 27, 0, 15,
0, 10, 0, 8, 0, 6, 0, 4, 0, 3, 0, 2,
0, 2, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0,
0
};
const signed int signed_B[61] = {
0, 0, 0, 0, 0, -1, 0, -1, 0, -1, 0, -2,
0, -2, 0, -3, 0, -4, 0, -6, 0, -8, 0, -10,
0, -15, 0, -27, 0, -81, 0, 81, 0, 27, 0, 15,
0, 10, 0, 8, 0, 6, 0, 4, 0, 3, 0, 2,
0, 2, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0,
0
};
float singal[N]={0.0022,0.9958,0.0027,-1.0044,-0.0337,0.9983,0.0025,
-1.0053,-0.00323,0.01805, 0.0012,-0.0004,-0.0097,-0.0081,-0.0015,
0.0019,0.0057,0.0239,0.0198,-0.0175 ,0.0256,-0.0144,0.0375,
0.0029,-0.0064,0.9705,-0.0058,-0.9775,-0.0060,0.9934,
-0.0192,-1.0171,-0.0084,0.0053,-0.0301,0.0097,-0.0070,0.0117,
-0.000063,-0.0065,0.0073,0.0074,0.0296,-0.01900,0.01025,-0.0179,
-0.0083,-0.0074,-0.0064,-0.0068,-0.0075,-0.0035,0.0063,0.0163,
-0.0053,0.0267,0.0127,0.0178,-0.0143,-0.0267,0.0048,0.0050,
-0.0248,-0.0217,0.0051,1.0151,0.0198,-1.0134,0.0088,1.0090,
-0.0005,-1.0154,-0.0161,1.0108,-0.0246,-1.0043,0.0021,1.0160,
-0.0052,-1.0203,0.0051,-0.0105,0.0259,-0.0127,0.0025,0.0298,
0.0154,-0.0002,0.0069,0.0351,0.0204,-0.0194,0.0027,0.0155,
-0.0224,0.0042,-0.0010,1.0042,-0.0118,-1.0267,-0.0157,1.0274,
-0.0019,-1.0139,0.0214,0.0134,-0.0126,0.0157,0.0162,-0.0113,
0.0079,-0.0054,0.0183,0.9816,-0.0060,-0.9880,-0.0012,1.0084,
0.0254,-1.0062,-0.01600,1.0228,-0.0064,-0.9954,0.0022,0.9958,
0.0027,-1.0044 };
float singal_hilbert[N]={1};
float am[N]={0};
float am_mean=0;
float an[N]={0};
float indices[N]={0};
signed int c=0;
float phase[N]={0};
float phase1[N]={0};
float phase2[N]={0};
float Ck[N]={0};
float f1[N]={0};
float fcn[N]={0};
float f1_mean=0;
float phase2_mean=0;
float a_temp=0;
float a=0;
float b=0;
float d=0;
float sigmadp;
float sigmaap;
float uf42_temp1=0;
float uf42_temp2=0;
float uf42_temp4=0;
float uf42=0;
float sin_tab1[180]={0};
float sin_f_temp=0;
void decision()
{
//希尔伯特变换
int i,j,m;
m=0;
for (j=61;j 1)
{ indices[c]=an;
c++;
}
}
//修正相位序列
for (i=1;i pi)
Ck=Ck[i-1]-2*pi;
else if (phase-phase[i-1] pi)
phase1=phase1-2*pi;
else if(phase1 pi)
phase2=phase2-2*pi;
else if(phase2 1)
{
a_temp=phase2-phase2_mean;
a+=a_temp*a_temp;
b+=a_temp;
d+=abs(a_temp);
}
}
// sigmadp=sqrt(a/C-(b/C)^2);sigmaap=sqrt(a/C-(d/C)^2);
sigmadp=sqrt(a/c-(b/c)^2);
sigmaap=sqrt(a/c-(d/c)^2);
}
在编译到最后两行的时候出错。错误提示为expression must have integral type。其中,a,b,d定义float型,c定义是整型,sigmadp定义float.请问错在哪里,怎么改,谢谢大家了!
* juece.c
*
* Created on: 2015-5-16
*
*/
#include"math.h"
#define pi 3.1415
#define fs 2000//采样率
#define fc 500 //载波
#define N 128 //采样点
#define TAB_max 180
#define step_angal 0.0174532925
//希尔伯特滤波器系数
const unsigned int B[61] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 81, 0, 27, 0, 15,
0, 10, 0, 8, 0, 6, 0, 4, 0, 3, 0, 2,
0, 2, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0,
0
};
const signed int signed_B[61] = {
0, 0, 0, 0, 0, -1, 0, -1, 0, -1, 0, -2,
0, -2, 0, -3, 0, -4, 0, -6, 0, -8, 0, -10,
0, -15, 0, -27, 0, -81, 0, 81, 0, 27, 0, 15,
0, 10, 0, 8, 0, 6, 0, 4, 0, 3, 0, 2,
0, 2, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0,
0
};
float singal[N]={0.0022,0.9958,0.0027,-1.0044,-0.0337,0.9983,0.0025,
-1.0053,-0.00323,0.01805, 0.0012,-0.0004,-0.0097,-0.0081,-0.0015,
0.0019,0.0057,0.0239,0.0198,-0.0175 ,0.0256,-0.0144,0.0375,
0.0029,-0.0064,0.9705,-0.0058,-0.9775,-0.0060,0.9934,
-0.0192,-1.0171,-0.0084,0.0053,-0.0301,0.0097,-0.0070,0.0117,
-0.000063,-0.0065,0.0073,0.0074,0.0296,-0.01900,0.01025,-0.0179,
-0.0083,-0.0074,-0.0064,-0.0068,-0.0075,-0.0035,0.0063,0.0163,
-0.0053,0.0267,0.0127,0.0178,-0.0143,-0.0267,0.0048,0.0050,
-0.0248,-0.0217,0.0051,1.0151,0.0198,-1.0134,0.0088,1.0090,
-0.0005,-1.0154,-0.0161,1.0108,-0.0246,-1.0043,0.0021,1.0160,
-0.0052,-1.0203,0.0051,-0.0105,0.0259,-0.0127,0.0025,0.0298,
0.0154,-0.0002,0.0069,0.0351,0.0204,-0.0194,0.0027,0.0155,
-0.0224,0.0042,-0.0010,1.0042,-0.0118,-1.0267,-0.0157,1.0274,
-0.0019,-1.0139,0.0214,0.0134,-0.0126,0.0157,0.0162,-0.0113,
0.0079,-0.0054,0.0183,0.9816,-0.0060,-0.9880,-0.0012,1.0084,
0.0254,-1.0062,-0.01600,1.0228,-0.0064,-0.9954,0.0022,0.9958,
0.0027,-1.0044 };
float singal_hilbert[N]={1};
float am[N]={0};
float am_mean=0;
float an[N]={0};
float indices[N]={0};
signed int c=0;
float phase[N]={0};
float phase1[N]={0};
float phase2[N]={0};
float Ck[N]={0};
float f1[N]={0};
float fcn[N]={0};
float f1_mean=0;
float phase2_mean=0;
float a_temp=0;
float a=0;
float b=0;
float d=0;
float sigmadp;
float sigmaap;
float uf42_temp1=0;
float uf42_temp2=0;
float uf42_temp4=0;
float uf42=0;
float sin_tab1[180]={0};
float sin_f_temp=0;
void decision()
{
//希尔伯特变换
int i,j,m;
m=0;
for (j=61;j 1)
{ indices[c]=an;
c++;
}
}
//修正相位序列
for (i=1;i pi)
Ck=Ck[i-1]-2*pi;
else if (phase-phase[i-1] pi)
phase1=phase1-2*pi;
else if(phase1 pi)
phase2=phase2-2*pi;
else if(phase2 1)
{
a_temp=phase2-phase2_mean;
a+=a_temp*a_temp;
b+=a_temp;
d+=abs(a_temp);
}
}
// sigmadp=sqrt(a/C-(b/C)^2);sigmaap=sqrt(a/C-(d/C)^2);
sigmadp=sqrt(a/c-(b/c)^2);
sigmaap=sqrt(a/c-(d/c)^2);
}
在编译到最后两行的时候出错。错误提示为expression must have integral type。其中,a,b,d定义float型,c定义是整型,sigmadp定义float.请问错在哪里,怎么改,谢谢大家了!