Skip to main content
5-Regular Member
February 12, 2024
Solved

Summing up Current Data columns in a Matrix based on associated Time Values

  • February 12, 2024
  • 1 reply
  • 3181 views

Using Prime 9.0

Hello,

I have a large matrix of time and current data for 6 different channels. The even columns (0,2,4,6,8,10) contain the time data for the odd current data columns to the right (1,3,5,7,9,11) - Excel image shown below for visual clarity.
I am trying to sum up the current data of the 6 channels into a 2 column matrix (time, current) adding the currents at the appropriate times. The time data is in microseconds with time steps of ~.006-.007 μs and the channels time data overlap with start times shifted by 7.5 μs. For example, Channel 0's time data spans from 7.5 μs to 41 μs, Channel 1's time data spans from 15 μs to 48.5 μs, and so on. I wrote the matrix data to an excel file and attached. 

Excel Image:

MM_10946130_1-1707764378704.png

MathCAD matrix:

MM_10946130_0-1707763841838.png

It's kind of hard to explain verbally, but basically the channels have time and current data that overlap, and I want to add the currents of the overlapping times accordingly. 

I have a user-defined function that simply adds up the odd current data columns together, but doesn't take into account the time data at all...

MM_10946130_0-1707766116390.png

Let me know if further clarification is needed, and I appreciate any help with this!

 

Best answer by Werner_E

So you simply want to add up the six sine-looking signals?

Doing it with the values in the table might be problematic.

 

channel 0 might have values at time stamp 80 ms and 82 ms but channel 1 might have timestamps 79 ms, 81 ms and 83 ms.

So I guess you will want to interpolate?

 

My suggestion would be to create interpolating functions (linear interpolation with "linterp" might be all thats needed), limit the function to the appropriate time range for each channel and then create the sum of all six functions.

 

Would this approach do the job?

Werner_E_0-1707783599969.png

Of course you now could sample the sum signal using time steps of your choice if you really need a vector of values.

1 reply

25-Diamond I
February 12, 2024

Its not clear to me what exactly you would like to add up and how you would like to involve the time stamps - especially its unclear what you mean by overlapping times.

 

Are you trying to implement some kind of numeric integration of the current over time, the result being charge values (ampere*seconds or Coulomb)?

 

Maybe you give an example of the result for one of the channels along with an explanation how you would arrive at that result with manual calculation.

And don't forget to attach your Prime worksheet.

 

25-Diamond I
February 12, 2024

Here is what I was talking about. Not sure if its what you are looking for, though

Werner_E_0-1707776391005.png

 

Prime 9 file attached