How to compute calculations on each dimension of the array?
2 views (last 30 days)
Show older comments
Hi, all!
The matrix D is 4096X1610 (spectra X wavenumbers). I want to subtract the average of each spectrum from D and the average of each wavenumber from corresponding wavenumber in D and put the result into a matrix. I have calculated for each dimension but I don't know how to combine results to get 4096X1610 matrix.
mean1 is mean of wavenumbers (1x1610) and mean2 is mean of spectrum (1x4096) from D.
My Code:
D4=D(4096,:)-mean1;
D5=D(:,1610)-mean2';
I want to combine what i have in D4 and D5 such that the dimensions of the output is 4096X1610 for further analysis. Any help is appreciated. Thanks!
0 Comments
Accepted Answer
Matt J
on 12 Mar 2014
Well, the code you've shown won't work. I think you really mean
D4=bsxfun(@minus,D,mean1);
D5=bsxfun(@minus,D,mean2(:));
Now you say you want to combine D4 and D5 in some way? As in D4+D5 or D4.*D5 ?
As you can see, there are many possibilities. You must define the operation for us.
3 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!