北航物理实验GPS模拟与声源定位实验报告_声源定位实验报告
北航物理实验GPS模拟与声源定位实验报告由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“声源定位实验报告”。
声源定位C++程序
#include #include using namespace std;#define c 2982 #define pai 3.1415926535 int main(){
cout
if(acos(D/sqrt(pow(A,2)+pow(B,2)))+angle2
cout > t0 >> t1 >> t2>> t3;t0 = t0 / 1000000;t1 = t1 / 1000000;t2 = t2 / 1000000;dt1 = t1t0;} // end main;
程序运行:
2、GPS模拟 C++程序:
#include #include #include using namespace std;#define c 2982 #define min 0.0000000001
void GPS(double x[10] , double y[10] , double t[10] , double x1 , double y1 , int num){
double a1,a2,a3,a4,b1,b2,mult,D=0,E=0;int i;while(1){
a1 = a2 = a3 = a4 = b1 = b2 = 0;for(i = 0;i
a1 = a1-(3*pow((x[i]-x1),2)+pow((y[i]/1000-y1),2)-pow(c*t[i]/1000000,2));a2 = a2+2*(x[i]/1000-x1)*(y1-y[i]/1000);a3 = a2;a4 = a4-(3*pow((y[i]-y1),2)+pow((x[i]/1000-x1),2)-pow(c*t[i]/1000000,2));
b1 = b2 = b1+(pow((x[i]/1000-x1),2)+pow((y[i]/1000-y1),2)-pow(c*t[i]/1000000,2))*(x1-x[i]/1000);b2+(pow((x[i]/1000-x1),2)+pow((y[i]/1000-y1),2)-pow(c*t[i]/1000000,2))*(y1-y[i]/1000);} //end for;mult = a3/a1;a4-= a2*mult;b2-= b1*mult;E = b2/a4;D =(b1-a2*E)/a1;x1 += D;y1 += E;if((pow(D,2)+pow(E,2))
GPS(x,y,t1,0,0,1);GPS(x,y,t2,0,0.3,2);GPS(x,y,t3,0.45,0,3);cin>>yy;return 0;int yy;double t1[10] , t2[10] , t3[10] , x[10] , y[10];
cout > t1[i] >> t2[i] >> t3[i] >> x[i] >> y[i];} // end for;
} // end main;
运行结果: