Asked by Amir Rashidi
on 11 Oct 2015

Hi, I try to calculate the energy in a time series dataset. I calculate the power for each record i.e. every hour. Now i would like to compute the energy for each row. I used the :diff" to find the duration for each row and then multiply that duration to power value to calculate the energy. however the final product is duration format. could you please help me with that?

Date Power (W)

'01-Jan-2005 00:00:00' 362374.8161

'01-Jan-2005 01:00:00' 290296.1116

'01-Jan-2005 02:00:00' 96520.39268

'01-Jan-2005 03:00:00' 96491.92618

'01-Jan-2005 04:00:00' 96420.53794

the code I used so far:

A = diff(dispt);

P(1, : ) = [];

E = P.*A;

Opportunities for recent engineering grads.

Apply Today
## 10 Comments

## Walter Roberson (view profile)

Direct link to this comment:https://it.mathworks.com/matlabcentral/answers/248005-element-wise-multiplication-of-duration-and-double-array#comment_315340

## dpb (view profile)

Direct link to this comment:https://it.mathworks.com/matlabcentral/answers/248005-element-wise-multiplication-of-duration-and-double-array#comment_315374

## Walter Roberson (view profile)

Direct link to this comment:https://it.mathworks.com/matlabcentral/answers/248005-element-wise-multiplication-of-duration-and-double-array#comment_315376

## dpb (view profile)

Direct link to this comment:https://it.mathworks.com/matlabcentral/answers/248005-element-wise-multiplication-of-duration-and-double-array#comment_315379

## Walter Roberson (view profile)

Direct link to this comment:https://it.mathworks.com/matlabcentral/answers/248005-element-wise-multiplication-of-duration-and-double-array#comment_315398

## dpb (view profile)

Direct link to this comment:https://it.mathworks.com/matlabcentral/answers/248005-element-wise-multiplication-of-duration-and-double-array#comment_315404

## Walter Roberson (view profile)

Direct link to this comment:https://it.mathworks.com/matlabcentral/answers/248005-element-wise-multiplication-of-duration-and-double-array#comment_315420

## dpb (view profile)

Direct link to this comment:https://it.mathworks.com/matlabcentral/answers/248005-element-wise-multiplication-of-duration-and-double-array#comment_315428

## Walter Roberson (view profile)

Direct link to this comment:https://it.mathworks.com/matlabcentral/answers/248005-element-wise-multiplication-of-duration-and-double-array#comment_315433

## dpb (view profile)

Direct link to this comment:https://it.mathworks.com/matlabcentral/answers/248005-element-wise-multiplication-of-duration-and-double-array#comment_315460

Sign in to comment.