Find double integration given a table of data?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm able to gather data from a device: The time passed and acceleration.
Given this sample data, I'm trying to find displacement.
I'm attempting to do this by double integration via Riemann sum, using the Trapezoidal method.
I know how to integrate once:
x = time data, y = acceleration data
T = (x2 − x1)(y1 + 2y2 + 2y3 + · · · + 2yn−1 + yn)/2
This will give me velocity. I'm not sure what to do from here in order to get displacement, since I'm given a table of data and not functions.
Am I just supposed to apply the process where the new data is the y1, 2y2, 2y3, etc?
Please help!
The code below uses basic sample data, but when actually implemented will be using collected acceleration data.
My code for implementation is below:
int main()
const int SIZE = 6;
int dataV[SIZE] = 2,4,6,8,10,12;
int timeV[SIZE] =100,300,500,700,900,1100;
//L = (x2 - x1)(y1 + y2 + ... + yn-1)
//R = (x2 - x1)(y2 + y3 + ... + yn)
//P = (x2 - x1)(y1 + 4y2 + 2y3 + 4y4 + ... + 2yn-2 + 4yn-1 + yn) / 3
//Get x2 - x1
int timePart = timeV[1] - timeV[0];
//FIND INTEGRAL USING TRAPEZOIDAL METHOD
//get summation of data values
int sum = dataV[0]; //sum begins with first element in data array
//T = (x2 − x1)(y1 + 2y2 + 2y3 + · · · + 2yn−1 + yn)/2
for (int i = 1; i < SIZE - 1; i++)
sum += 2 * dataV[i];
sum += dataV[SIZE - 1];
cout << "Sum = " << sum << endl;
float integral1 = timePart * sum;
integral1 /= 2;
cout << "Integral1 = " << integral1 << endl;
//multiple time and data values
return 0;
calculus integration definite-integrals
add a comment |Â
up vote
0
down vote
favorite
I'm able to gather data from a device: The time passed and acceleration.
Given this sample data, I'm trying to find displacement.
I'm attempting to do this by double integration via Riemann sum, using the Trapezoidal method.
I know how to integrate once:
x = time data, y = acceleration data
T = (x2 − x1)(y1 + 2y2 + 2y3 + · · · + 2yn−1 + yn)/2
This will give me velocity. I'm not sure what to do from here in order to get displacement, since I'm given a table of data and not functions.
Am I just supposed to apply the process where the new data is the y1, 2y2, 2y3, etc?
Please help!
The code below uses basic sample data, but when actually implemented will be using collected acceleration data.
My code for implementation is below:
int main()
const int SIZE = 6;
int dataV[SIZE] = 2,4,6,8,10,12;
int timeV[SIZE] =100,300,500,700,900,1100;
//L = (x2 - x1)(y1 + y2 + ... + yn-1)
//R = (x2 - x1)(y2 + y3 + ... + yn)
//P = (x2 - x1)(y1 + 4y2 + 2y3 + 4y4 + ... + 2yn-2 + 4yn-1 + yn) / 3
//Get x2 - x1
int timePart = timeV[1] - timeV[0];
//FIND INTEGRAL USING TRAPEZOIDAL METHOD
//get summation of data values
int sum = dataV[0]; //sum begins with first element in data array
//T = (x2 − x1)(y1 + 2y2 + 2y3 + · · · + 2yn−1 + yn)/2
for (int i = 1; i < SIZE - 1; i++)
sum += 2 * dataV[i];
sum += dataV[SIZE - 1];
cout << "Sum = " << sum << endl;
float integral1 = timePart * sum;
integral1 /= 2;
cout << "Integral1 = " << integral1 << endl;
//multiple time and data values
return 0;
calculus integration definite-integrals
Don't just compute the final velocity, fill an array with all intermediate velocities and integrate it. (You can also work this out without intermediate storage).
– Yves Daoust
Jul 24 at 15:38
what do you mean by intermediate velocities?
– sGlow
Jul 24 at 18:27
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm able to gather data from a device: The time passed and acceleration.
Given this sample data, I'm trying to find displacement.
I'm attempting to do this by double integration via Riemann sum, using the Trapezoidal method.
I know how to integrate once:
x = time data, y = acceleration data
T = (x2 − x1)(y1 + 2y2 + 2y3 + · · · + 2yn−1 + yn)/2
This will give me velocity. I'm not sure what to do from here in order to get displacement, since I'm given a table of data and not functions.
Am I just supposed to apply the process where the new data is the y1, 2y2, 2y3, etc?
Please help!
The code below uses basic sample data, but when actually implemented will be using collected acceleration data.
My code for implementation is below:
int main()
const int SIZE = 6;
int dataV[SIZE] = 2,4,6,8,10,12;
int timeV[SIZE] =100,300,500,700,900,1100;
//L = (x2 - x1)(y1 + y2 + ... + yn-1)
//R = (x2 - x1)(y2 + y3 + ... + yn)
//P = (x2 - x1)(y1 + 4y2 + 2y3 + 4y4 + ... + 2yn-2 + 4yn-1 + yn) / 3
//Get x2 - x1
int timePart = timeV[1] - timeV[0];
//FIND INTEGRAL USING TRAPEZOIDAL METHOD
//get summation of data values
int sum = dataV[0]; //sum begins with first element in data array
//T = (x2 − x1)(y1 + 2y2 + 2y3 + · · · + 2yn−1 + yn)/2
for (int i = 1; i < SIZE - 1; i++)
sum += 2 * dataV[i];
sum += dataV[SIZE - 1];
cout << "Sum = " << sum << endl;
float integral1 = timePart * sum;
integral1 /= 2;
cout << "Integral1 = " << integral1 << endl;
//multiple time and data values
return 0;
calculus integration definite-integrals
I'm able to gather data from a device: The time passed and acceleration.
Given this sample data, I'm trying to find displacement.
I'm attempting to do this by double integration via Riemann sum, using the Trapezoidal method.
I know how to integrate once:
x = time data, y = acceleration data
T = (x2 − x1)(y1 + 2y2 + 2y3 + · · · + 2yn−1 + yn)/2
This will give me velocity. I'm not sure what to do from here in order to get displacement, since I'm given a table of data and not functions.
Am I just supposed to apply the process where the new data is the y1, 2y2, 2y3, etc?
Please help!
The code below uses basic sample data, but when actually implemented will be using collected acceleration data.
My code for implementation is below:
int main()
const int SIZE = 6;
int dataV[SIZE] = 2,4,6,8,10,12;
int timeV[SIZE] =100,300,500,700,900,1100;
//L = (x2 - x1)(y1 + y2 + ... + yn-1)
//R = (x2 - x1)(y2 + y3 + ... + yn)
//P = (x2 - x1)(y1 + 4y2 + 2y3 + 4y4 + ... + 2yn-2 + 4yn-1 + yn) / 3
//Get x2 - x1
int timePart = timeV[1] - timeV[0];
//FIND INTEGRAL USING TRAPEZOIDAL METHOD
//get summation of data values
int sum = dataV[0]; //sum begins with first element in data array
//T = (x2 − x1)(y1 + 2y2 + 2y3 + · · · + 2yn−1 + yn)/2
for (int i = 1; i < SIZE - 1; i++)
sum += 2 * dataV[i];
sum += dataV[SIZE - 1];
cout << "Sum = " << sum << endl;
float integral1 = timePart * sum;
integral1 /= 2;
cout << "Integral1 = " << integral1 << endl;
//multiple time and data values
return 0;
calculus integration definite-integrals
edited Jul 24 at 18:31
asked Jul 24 at 14:51
sGlow
32
32
Don't just compute the final velocity, fill an array with all intermediate velocities and integrate it. (You can also work this out without intermediate storage).
– Yves Daoust
Jul 24 at 15:38
what do you mean by intermediate velocities?
– sGlow
Jul 24 at 18:27
add a comment |Â
Don't just compute the final velocity, fill an array with all intermediate velocities and integrate it. (You can also work this out without intermediate storage).
– Yves Daoust
Jul 24 at 15:38
what do you mean by intermediate velocities?
– sGlow
Jul 24 at 18:27
Don't just compute the final velocity, fill an array with all intermediate velocities and integrate it. (You can also work this out without intermediate storage).
– Yves Daoust
Jul 24 at 15:38
Don't just compute the final velocity, fill an array with all intermediate velocities and integrate it. (You can also work this out without intermediate storage).
– Yves Daoust
Jul 24 at 15:38
what do you mean by intermediate velocities?
– sGlow
Jul 24 at 18:27
what do you mean by intermediate velocities?
– sGlow
Jul 24 at 18:27
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2861436%2ffind-double-integration-given-a-table-of-data%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Don't just compute the final velocity, fill an array with all intermediate velocities and integrate it. (You can also work this out without intermediate storage).
– Yves Daoust
Jul 24 at 15:38
what do you mean by intermediate velocities?
– sGlow
Jul 24 at 18:27