From: Ahmad Alkandri on 27 Jun 2010 13:43 hi how would i use the for loop output to get the best value .. ie for i = 1:15 for k = 1:15 tt = (a(i) + b) / y(k)); result = (tt *2) +1; end end what i need is to be able to save the min value of ( result ) also the values of ( a ) and ( y ) where the min value of result happened ?
From: us on 27 Jun 2010 14:57 "Ahmad Alkandri" <a_alkandri(a)yahoo.com> wrote in message <i082j9$j8n$1(a)fred.mathworks.com>... > hi > > how would i use the for loop output to get the best value .. ie > > > > for i = 1:15 > for k = 1:15 > tt = (a(i) + b) / y(k)); > result = (tt *2) +1; > end > end > > what i need is to be able to save the min value of ( result ) also the values of ( a ) and ( y ) where the min value of result happened ? one of the many(!) solutions amin=nan; ymin=nan; rmin=inf; for ... for ... result=... % insert >>> if result < rmin amin=a(i); ymin=y(k); rmin=result; end % insert <<< end end us
From: Ahmad Alkandri on 27 Jun 2010 17:30 ok here is the problem ..... i'm running a filtering operation on an image with different variables ..... i want to find the best result when changing a, b and y ..... when the result found .. i would like to mesh the correlation function (z) using the best values a,b and y for i=1:15 for j=1:1 for k=1:15 h = filt(img,a(i),b(j),y(k)); [pce,PSR,AHH,info,z] = correlation (tgtfft,h); %% correlation function PCE_Result(i+offset,k)=pce; PSR_Result(i+offset,k)=PSR; AHH_Result(i+offset,k)=AHH; info_Result(i+offset,k)=info; result = (AHH_Result/info_Result); if result > rmin abest = a(i); bbest = b(j); ybest = y(k); rmin = result; figure ,mesh(real(z)), axis tight , shading interp; end end end end would you help me this please
|
Pages: 1 Prev: Code request Next: What is the problem with my equalizer? |