Create single columns of elementwise means

How would I compute the elementwise means of dark fields and flat fields, to get both a single dark field and a single flat field column to use in correction. I then need to apply the single dark mean and flat field mean for correcting the transmission data (X_proj).
X_dark = 2560x30 double
X_flat = 2560x200 double
X_proj = 2560x1500 double
My attempt for X_dark is below, does this look correct? How would I then apply it to correct the transmission data (X_proj)?
temp=zeros(2560,1);
for i=1:30
temp=temp+X_dark(:,i);
end
X_dark_avg=temp./30;

3 件のコメント

Stephen23
Stephen23 2021 年 5 月 13 日
"My attempt for X_dark is below, does this look correct?"
The MATLAB approach would be to avoid the loop and call mean with its optional dimension argument:
X_dark_avg = mean(X_dark,2)
Ryan
Ryan 2021 年 5 月 14 日
編集済み: Ryan 2021 年 5 月 14 日
Thanks! How can the averaged single columns for X_dark_avg and X_flat_avg then be applied 1500 times for correcting the X_proj data?
Jan
Jan 2021 年 5 月 14 日
@Ryan Philips: It depends on what "applying" means here. Please explain, which mathematical operation you want to perform.

サインインしてコメントする。

 採用された回答

Matt J
Matt J 2021 年 5 月 14 日

0 投票

DF=mean(X_dark ,2);
FF=mean(X_flat ,2);
X_corrected=(X_proj-DF)./(FF-DF);

1 件のコメント

Ryan
Ryan 2021 年 5 月 14 日
Great, thanks! That code solution is working!

サインインしてコメントする。

その他の回答 (0 件)

製品

質問済み:

2021 年 5 月 13 日

コメント済み:

2021 年 5 月 14 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by