Why is it used?
古いコメントを表示
I would like to understand a code which is given here... at the line, 94, why the line, 94, is used?
for ii=1 : data.Np
71
81
82 %Form the range profile with zero padding added
83 rc=fftshift(ifft(data.phdata(:,ii),data.Nfft));
84
85 %Calculate differential range for each pixel in the image(m)
86 dR=sqrt((data.AntX(ii)-data.x mat).ˆ2 + (data.AntY(ii)-data.y mat).ˆ2;
89
90 %Calculate phase correction for image
91 phCorr=exp(1i*4*pi*data.minF(ii)/c*dR);
92
93 %Determine which pixels fall within the range swath
94 I=find(and(dR > min(data.r vec),dR < max(data.r vec))); --> Why this line is used...
95
96 %Update the image using linear interpolation
97 data.im final(I)=data.im final(I)+interp1(data.r vec,rc,dR(I),'linear').* phCorr(I);
98
101 end
already thank you very much for your helps...<http://mathworks.com/ MathWorks>
2 件のコメント
Walter Roberson
2011 年 5 月 8 日
It would help if you told us what the code is intended to do.
Harun Cetinkaya
2011 年 5 月 8 日
回答 (1 件)
Andrew Newell
2011 年 5 月 8 日
As written, your code cannot possibly run because of some of the spaces. I will substitute underlines:
I=find(and(dR > min(data.r_vec),dR < max(data.r_vec)));
This line returns the index numbers of all the elements of dR that are greater than the minimum value of data.r_vec and less than the maximum value of data.r_vec - in other words, all the values of dR that are within the range of values of data.r_vec.
This index is used to update only those values of data.im_final that apply to the points with these values of dR:
data.im_final(I)=data.im_final(I)+interp1(data.r_vec,rc,dR(I),'linear').* phCorr(I);
Here is a simple analogy. Suppose you have a set of data Y at points X and you want to set all the points inside of -1 < X < 2 to zero. You could write
for i=1:length(Y)
if and(X>-1,X<2)
Y(i) = 0;
end
end
or you could do this:
I = find(and(X>-1,X<2));
Y(I) = 0;
or, even better, you could do this:
Y(X<1 & X<2) = 0;
This last is an example of logical indexing.
カテゴリ
ヘルプ センター および File Exchange で Image Segmentation についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!