Find double integration given a table of data?

The name of the pictureThe name of the pictureThe name of the pictureClash 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;







share|cite|improve this question





















  • 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














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;







share|cite|improve this question





















  • 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












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;







share|cite|improve this question













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;









share|cite|improve this question












share|cite|improve this question




share|cite|improve this question








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
















  • 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















active

oldest

votes











Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















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



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














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













































































Comments

Popular posts from this blog

What is the equation of a 3D cone with generalised tilt?

Color the edges and diagonals of a regular polygon

Relationship between determinant of matrix and determinant of adjoint?