フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Finding Maximum value in a loop

2 ビュー (過去 30 日間)
yasmin
yasmin 2012 年 7 月 23 日
Hi all i am trying to find the maximum value in the loop below, can someone please help and explain
for i=1:100 for angle=-90:90;
phi=angle*pi/180;
xdata=[sin(sno+(phi))];
ydata=(m_mata(:,:,i))
R=(corrcoef(xdata,ydata));
end
example Result from R are
1.0000 0.6581
0.6581 1.0000
within the loop above i want to find the maximum value of R(2,1) and also the associated angle that is been used in xdata to give the maximum of R(2,1).
basically I am wanting to find the maximum of R(2,1)and also the associated angle that is been used in xdata to give the maximum of R(2,1),for each time I run for i=1:100, for each loop I want to store the value of R(2,1) and the compare the new value with previous value if the new value is greater for when i=2 then this will be the maximum of R(2,1).If the maximum value of R(2,1) when i=2 is smaller then we use the maximum of R(2,1) when i=1 At the end of the iteration I want to end up with a maximum value of R(2,1) and also the associated phi
I am a bit inexperienced with programming and not sure how to capture this concept and put it in Matlab.
Your help is much appreciated.
  1 件のコメント
Ryan
Ryan 2012 年 7 月 23 日
Perhaps this user had some luck.

回答 (0 件)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by