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?
No, that is wrong. Correct would be