フィルターのクリア

Can someone explain to me how this function works?

1 回表示 (過去 30 日間)
Andrew Ardolino
Andrew Ardolino 2014 年 11 月 17 日
回答済み: Roger Stafford 2014 年 11 月 18 日
function finElemNext = nextTemps( finElem )
% This function will create a new fin element array by averaging the
% temperatures surrounding each element location
% uses finElemNext = nextTemps( finElem )
global maxDelta
maxDelta=0;
newFin=zeros(numRows,numCols);
for i = 2 : (numRows - 1)
for j = 2 : (numCols - 1)
t_original=finElem(i,j);
if t_original~=steamTemp
t_row_above=finElem(i-1,j);
t_row_below=finElem(i+1,j);
t_col_left=finElem(i,j-1);
t_col_right=finElem(i,j+1);
newFin(i,j)=mean([t_original,t_row_above,t_row_below,t_col_left,t_col_right]);
delta=finElem(i,j)-newFin(i,j);
if delta>maxDelta
maxDelta=delta;
end
else
newFin(i,j)=finElem(i,j);
end
end
end
finElemNext=setupFin(newFin);
end
I just need to be able to explain how this program calculates the data for this function. Thanks in advance :)
  2 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 11 月 17 日
Explain what?
Andrew Ardolino
Andrew Ardolino 2014 年 11 月 17 日
Just in normal language how the function calculates the next temperature for a single cell in the fin array.

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

採用された回答

Roger Stafford
Roger Stafford 2014 年 11 月 18 日
The complete 'nextTemps' function is not shown, so we are left guessing about some parts of it. For example we can only guess that 'numRows' and 'numCols' are the numbers of rows and columns of 'finElem'.
Each of the elements of 'finElem' which are not equal to 'steamTemp' and which are not along its borders are replaced in 'newElem' by the mean (average) of itself and its four nearest neighbors. Before 'setupFin' is called, the borders of 'newElem' are left as zeros. There is no way to tell what happens after 'setupFin' is called, but apparently the original border values of 'finElem' are permanently lost. A record is kept in 'maxDelta' of the maximum decrease occurring from 'finElem' to 'newElem', but this maximum does not appear to be returned by 'nextTemps'.
Taken all-in-all, this function, 'nextTemps', or at least its presentation here, is altogether unsatisfactory.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDenoising and Compression についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by