Quantcast
Channel: MATLAB Central Newsreader - tag:"mean"
Viewing all articles
Browse latest Browse all 26

inf values for mean(___) and sum(___) functions

$
0
0
Dear Matlab community,

I am currently facing a little issue:

I have a matrix with share volume (SHVOL) and shares outstanding (SHROUT). Both are over the same time period and the same companies, of course. Since the dataset is very long, it contains a lot of NANs.

I would like to compute share turnover (TURNO), which is (SHVOL)/(SHROUT). I use the following code for that:

TURNO = (abs(SHVOL)./abs(SHROUT);

after that, I want to compute the mean turnover (mTURNO) for each period:

mTURNO = nanmean(ans(TURNO),2);

nanmean computes the mean while ignoring NANs, and 2 indicates a mean of column values.

Mast values of my (n x 1) mTURNO matrix look fine, but some of them state 'inf'. There is clearly some error. Does anyone have a suggestion how to fix it?

Thank you very much!

Cheers,

Chris

Viewing all articles
Browse latest Browse all 26

Trending Articles