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 Kommentare

Walter Roberson
Walter Roberson am 8 Mai 2011
It would help if you told us what the code is intended to do.
Harun Cetinkaya
Harun Cetinkaya am 8 Mai 2011
The code is a back projection method code... at 83 line, measured data, phData(Freq, xPosition). One dimensional Fourier transform of measured data which is measured at each xPosition is calculated for each xPosition... dR is a matrix keeping the image pixels disntance... at 96, for each xPosition, the result is summed to previous one.
REally thank you

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Andrew Newell
Andrew Newell am 8 Mai 2011

0 Stimmen

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.

Produkte

Gefragt:

am 8 Mai 2011

Community Treasure Hunt

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

Start Hunting!

Translated by