公式有没有错我就不知道了
#include
#include
int main()
{
int N,n,d,S,s,Sb,ai,S0,E0,angle,f,v; //N:组元,d:排列间距,n:子波波长,S相位角,s,激发相位差,Sb空间相位差,ai激励振幅,S0总场强,E0能量,angle:方位角,f:子波主频,v:速度//
double X,X0,pi,SS;
FILE *file;
file=fopen("1.txt", "w");
pi=3.14;
printf("pless input N and press enter");
N=getchar();
printf("pless input d and press enter");
d=getchar();
printf("pless input n and press enter");
n=getchar();
printf("pless input S and press enter");
S=getchar();
printf("pless input s and press enter");
s=getchar();
for(angle=0;angle<=360;angle++)
{
S=2*pi*f*d*cos(angle)/v+Sb;//计算相位角//
E0=abs(sin(N/2*S)/N*sin(1/2*s));//计算能量响应//
printf("angle=%d\n",angle);
printf("E0=%d\n",E0);
fprintf(file, "angle=%d\n",angle);
fprintf(file, "E0=%d\n",E0);
}
fclose(file);//关闭文件
return 0;
}