/* * @(#) smt2_1.c - Program for determining target points hit extrapolated * trajectory capture gate (Task 2_1 at the Special Military Training course). * (c) 1997 Ivan Maidanski http://ivmai.chat.ru * Freeware program source. All rights reserved. ** * Language: ANSI C * Tested with: Borland C++ v3.1 * Last modified: 1997-05-05 21:15:00 GMT+04:00 */ #include #define MAX_M 20 float ax[MAX_M],ay[MAX_M],az[MAX_M]; float extrapolate(float dt, float x, float dx, float ddx) { return (x+dt*(dx+dt*ddx/2.0)); } int ingate(float dx, float dy, float dz, float sigmax, float sigmay, float sigmaz) { return ((dx/sigmax)*(dx/sigmax)+(dy/sigmay)*(dy/sigmay)+ (dz/sigmaz)*(dz/sigmaz)<9.0); } int main() { int i,m; float tk,tn; float x,dx,ddx,y,dy,ddy,z,dz,ddz; float sigmax,sigmay,sigmaz; printf("tk= "); scanf("%f",&tk); printf("x= "); scanf("%f",&x); printf("x'= "); scanf("%f",&dx); printf("x''= "); scanf("%f",&ddx); printf("y= "); scanf("%f",&y); printf("y'= "); scanf("%f",&dy); printf("y''= "); scanf("%f",&ddy); printf("z= "); scanf("%f",&z); printf("z'= "); scanf("%f",&dz); printf("z''= "); scanf("%f",&ddz); printf("sigma_x= "); scanf("%f",&sigmax); printf("sigma_y= "); scanf("%f",&sigmay); printf("sigma_z= "); scanf("%f",&sigmaz); printf("\n"); printf("m= "); scanf("%d",&m); printf("tn= "); scanf("%f",&tn); for (i=0;i