0

I'm doing an experimental program. I need to find elevation from a set of experimental data. I record only time and acceleration data and I used Forward Euler Method to solve the double integration. The code that I wrote is this.

public void forward_method(double[] acceleration, double[] time){
    double deltaT = time[1] - time[0];
    double velocity[] = new double[time.length];
    double displacement[] = new double[time.lenght];

    velocity[0] = 0; 
    displacement[0] = 0;

   for(int i = 0; i < acceleration.length - 1; i++){
       velocity[i + 1] = velocity[i] * acceleration[i] * deltaT;
       displacement[i + 1] = displacement[i] * velocity[i] * deltaT;
   }
}

Is it correct for find velocity and displacement? How can I modify it to find elevation?

traveller
  • 83
  • 3
  • 13
  • Have you tried anything to find the elevation? – wake-0 Dec 23 '16 at 17:56
  • I read about projectile motion. I don't know, if is the same application to my problem, i record also orientation angle value from my sensor, i think that are useful to my problem. Because if I divide the velocity vector along its y components: vyf = vyi – g t = vi sen Θi – g t, and substitute g with ai (that represent – traveller Dec 24 '16 at 11:50
  • my vertical acceleration at time i), i think that elevation could be calculate as follows yf = (vi sen Θi) t – ½ ai t^2, but i don't know if i can substitute sen Θi with sen azimuth at time ti – traveller Dec 24 '16 at 11:50

1 Answers1

0

No, that is wrong. Correct would be

   velocity[i + 1] = velocity[i] + acceleration[i] * deltaT;
   displacement[i + 1] = displacement[i] + velocity[i] * deltaT;
Lutz Lehmann
  • 25,219
  • 2
  • 22
  • 51