wjm19871117 发表于 2008-5-9 10:04

有谁能帮我看一下这段程序是什么意思?拜托了,我正在搞毕业设计!

aMain3.cpp
        #include <string.h>
        #include <fstream.h>
        #include <iostream.h>
        #include <stdio.h>
        #include <stdlib.h>  
        #include <math.h>
        #include <iomanip.h>
        #include <time.h>

        #include "simulation_aim9.h"

void main()
{
        simulation_aim9                getTraj;

        VectorType                ownship_Position0;
        FpsVectorType        ownship_Velocity0;
        VectorType                tgt_Position0;
        FpsVectorType        tgt_Velocity0;
   
        Float64Type       theta;

        ownship_Position0.x = 0.0;                               
        ownship_Position0.y = 0.0;                       
        ownship_Position0.z = 0.0;       
       
        ownship_Velocity0.x = 0.0;
        ownship_Velocity0.y = 100.0;
        ownship_Velocity0.z = 0.0;

//        tgt_Position0.x = 2000.0;
//        tgt_Position0.y = 2000.0;
//        tgt_Position0.z = 2000.0;

//        tgt_Velocity0.x = -300.0;
        tgt_Velocity0.y =  0.0;
//        tgt_Velocity0.z = -300.0;

        double        V0 = 500.0;        //meter/sec
    char        filenames[100];

        sprintf(filenames, "trajectory555.m");
        ofstream outFileTraj(filenames, ios::app);
        outFileTraj<<"traj"<<"=[..."<<endl;

for(tgt_Position0.y=20000;tgt_Position0.y>=1000;tgt_Position0.y-=1000){

        for(theta=0;theta<2*PI;theta+=PI/24){
       
                tgt_Position0.x=R*cos(theta);
                tgt_Position0.z=R*sin(theta);
     
                tgt_Velocity0.x=-V0*cos(theta);
                tgt_Velocity0.z=-V0*sin(theta);   
   
                ownship_Velocity0.x = 100.0*cos(theta);
                ownship_Velocity0.z = 100.0*sin(theta);

      getTraj.simulateMissile_Tgt_Bait_Motion(ownship_Position0,
                          ownship_Velocity0,tgt_Position0, tgt_Velocity0);
   }
}       
      outFileTraj<<"];"<<endl;
}

PcrazyC 发表于 2008-5-9 10:43

最重要的文件不发上来,怎么知道做什么[tk13]

simulation_aim9.h

wjm19871117 发表于 2008-5-9 14:49

对不起,文件太多了,我不知道哪些是重要的?

#ifndef SIMULATION_H
#define SIMULATION_H


#include "General.h"
#include "targetModel_aim9.h"
#include "missileModel_aim9.h"


class simulation_aim9
{
public:

        simulation_aim9(void);

private:

        int                                mMatrixContr;
        int                                mIcountMax;
        int                                mMinMax;

        SecondType                mTSin;

        FeetType                mRangeToTarget;                       
        RadianType                mPathAngleTarget0;
        RadianType                mHeadingAngleTarget0;
        FpsType                        mVTarget0;
        VectorType                mRT;                               
        RadianType                mQAngle_z0;                       
        RadianType                mQAngle_y0;       
        RadianType                mQA_z0;       
        RadianType                mQA_y0;                       

public:
        SecondType                mh0;                               

        SecondType                mTime_Start;
        SecondType                mTime[3000];
        FeetVectorType        mTPosition[3000];       
        FpsVectorType        mTVelocity[3000];       
        Fps2VectorType        mTAccel[3000];               
        VectorType                mTAngle[3000];               
        FeetVectorType        mTPosition_real[3000];       
        FpsVectorType        mTVelocity_real[3000];       
        Fps2VectorType        mTAccel_real[3000];               

        FeetVectorType        mMissilePosition[3000];       
        FpsVectorType        mMissileVelocity[3000];       

        FeetType                mMissDistance[3000];
        FpsType                        mRelativeVel[3000];

        VectorType                mTgtPosi;
        VectorType                mTgtVel;
        Fps2VectorType        mTgtAccel;
        VectorType                mTgtPosi_real;
        VectorType                mTgtVel_real;
        Fps2VectorType        mTgtAccel_real;

        VectorType                mRO;                               
        RadianType                mPathAngleOwnership0;
        RadianType                mHeadingAngleOwnership0;

        FeetVectorType        mOTPosition[3000];       
        FpsVectorType        mOTVelocity[3000];       
        Fps2VectorType        mOTAccel[3000];       

private:
        void ProduceTrajectory(SecondType time, FlyerManueverType flyerManueverType,
                int iCountMax);

        int         RkForwardIntegration1(Int32Type n, Float64Type step, int L,
                        Float64Type y[], Float64Type dy[], Float64Type b[], Float64Type c[]);

        void MotionDifferentialEquation(SecondType time, Float64Type x[],
                                                         Float64Type func[]);

        void simulateMissileTgtMotion(int tgtNumber, Float64Type load, VectorType ownship_RO,
                FpsType ownship_Speed, RadianType ownship_PathAngle, RadianType ownship_HeadingAngle,
                RadianType qAngle_y, RadianType qAngle_z, FeetType rangeToTarget,
                FpsType vTarget0, RadianType tgt_headingAngle0, RadianType tgt_pathAngle0,
                int min_Max, RadianType positionAngle_y, RadianType positionAngle_z,
                VectorType tgt_Position0, FpsVectorType tgt_Velocity0);
       
        void store_Pa

页: [1]

编程论坛