Message Boards Message Boards

Numerical integration of data imported for Excel

I am using v10 to achieve numerical of a cell imported from excel. The data are 'y' values and deltax is .12. I am unable to understand and apply the appreciate syntax; see attached nb.

14 Replies

My apologies for not replying to your earlier post. I had missed it. I am pleased that things have worked out well for you. Best of luck

POSTED BY: David Reiss

David,

Everything in your formulation is providing satisfactory results ~ .7 percent compared to measured data. At first I had a problem but it was caused because of lack of scaling factor.

luke

I have made some changes to the integrand, I have tried to correct the formulation but was unsuccessful. could you look at the note book and tell ne what you think.

Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

luke

Attachments:

In your previous case your data was in 256 rows with one column. Now it is in one row with 500 columns. Therefore your list structure is different. Please read up on list structures in Mathematica:

http://reference.wolfram.com/language/howto/WorkWithLists.html

The basic point is that the answer to your original question was tailored to the very specific data structure that your Excel import generated. If the dat structure changes then you need to modify your code accordingly to get the data that you need. In your new example it would be

dx = .12
dx (Integrate[
   Interpolation[data1[[1, 1]], InterpolationOrder -> 2][x], {x, 1, 
    500}])
POSTED BY: David Reiss

Thanks David

Attached is a nb. where I'm trying to integrate a row of data from an imported Excel spreadsheet. In a previous attempt the formulation executed as expected but I was using 256 points (columns). However, when I went to 500 points the formulation failed to execute. Any suggestions?

Thanks

Luke

Hi Luke, not sure why you are asking the same question again--perhaps a problem with the community interface? See my comments above.

POSTED BY: David Reiss

David, I received your results and appropriately and successfully applied them.

Attached is a nb. where I'm trying to integrate a row of data from an imported Excel spreadsheet. In a previous attempt the formulation executed as expected but I was using 256 points (columns). However, when I went to 500 points the formulation failed to execute. Any suggestions?

Thanks

Luke

Attachments:

Thanks David, your responses have been a significant help and supported my goal. When I saw your response it appeared that your formulation could be expanded to be general and generic for my application. I was thinking of about 800 simultaneous integration (rows) with 500(columns). Right now I'll work on what you gave me and if I go after the expanded problem I'll be back and define specific objectives.

Thanks --- Luke

What one would do with a spreadsheet with additional information in it depends on what that data is and what you want to do with it. Each example case will be different depending on (a) the data and (b) what you want to do with the data.

POSTED BY: David Reiss

David I tried the solution (formulation) you provided above and it executed fine and I thought your additional comments were very helpful and insightful; thanks.

  I was wondering if you could provide some insight regarding a formulation for an entire spreadsheet. In the note book I provided, the data represented only one row from a spreadsheet. Which you understood. 

 I don't know how to setup the formulation "(Integrate[Interpolation[First[data1]"..........  ) for an entire spreadsheet; I don't know how to expand "(Integrate[Interpolation[First[data1]"..........  ) assuming the rest of the formulation follows from what you provided above.

Thanks, luke

Thanks luke

A few comments which I think may help. The first one is that your expression

delta x = .12

should be

deltax = .12

I.e. no space between the delta and the x. (I realize that this is not used in your notebook to the point you showed, but you would probably use it in the next step.)

The second one is that your data1 parameter is a list that contains a list with the data you are interested in. I.e. it has the form

{
  {number, number, number....}
}

And you want to interpolate, not data1, but First[data1]. (The reason it is a list inside of a list is that when Importing form Excel, each sheet in the original spreadsheet it placed in a separate list so you can access each sheet as needed for a multiple sheet spreadsheet.)

Thus your integration expression should be

Integrate[
 Interpolation[First[data1], InterpolationOrder -> 2][x], 
{x, 1, 256}]

Note that I also changed the integration range. Remember in Mathematica that array indices start at 1, not 0. If you take a look at the interpolation expression's output by evaluating the following on its own

Interpolation[First[data1], InterpolationOrder -> 2]

you will see the assumed range of the interpolation in the formatted output.

So your integration ultimately will be,

deltax (Integrate[
 Interpolation[First[data1], InterpolationOrder -> 2][x], 
{x, 1, 256}])

I hope this helps...

POSTED BY: David Reiss

No notebook was attached. Also when you attach the notebook, also attach the supporting Excel file so one can test it.

POSTED BY: David Reiss

Thanks for the help:Notebook attached

Attachments:
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract