function [] = spectrum(temp) [s1 s2]=size(temp); temp=temp/max(max(temp)); color = ['b' 'g' 'r' 'c' 'm' 'y' 'k' ':' '--' '*']; figure; for g=.1:.1:.5 a=(temp>=g)-sum(sum(temp>=g))/s1/s2; c=zeros(512,512); c(1:s1,1:s2)=a; cf=fft2(c); bf=zeros(1,ceil(512/sqrt(2))); numb = zeros(1,length(bf)); for i=1:256 for j=1:256 if (i~=1)|(j~=1) bf(round(sqrt(i^2+j^2)))=bf(round(sqrt(i^2+j^2)))+abs(cf(i,j)); numb(round(sqrt(i^2+j^2)))=numb(round(sqrt(i^2+j^2)))+1; end end end l=length(bf); l=6*floor(l/6); numb=numb+(numb==0); bf=bf./numb/g/(1-g); df=bf(1:6:l)+bf(2:6:l)+bf(3:6:l)+bf(4:6:l)+bf(5:6:l)+bf(6:6:l); plot((1:length(df))/length(df)/sqrt(2),df,color(round(10*g)));hold on; g end hold off;