Вы находитесь на странице: 1из 22

DEGREE of MASTER OF ENGINEERING in AERONAUTICAL ENGINEERING

ADVANCED TECHNIQUES IN FLUID DYNAMICS 5

PIV Analysis of Vortex Generation on a Delta Wing Daniel Dineen 0602320

Abstract
This report outlines the results of a Particle Image Velocimetry (PIV) experiment carried out on a slender delta wing. The paper explores the leading edge vortex shedding found on delta wings at low Mach numbers, whilst evaluating PIV as a experimental technique in uid mechanics. An algorithm was developed to process the images obtained during the experiments. This split the images into small tiles and used a cross-correlation method to produce the velocity eld. The algorithm was validated using synthetic images of known ows. During the tests, a number of possible sources of error were identied and discussed. The most obvious of these were the bias errors associated with the use of digital imaging equipment. Another problem encountered during the experiment was caused by the effects of surface glare on the image. This lead to the acquisition of an incomplete velocity eld and the experiment being carried out again with an improved setup.

Contents
1. Introduction
1.1 Particle Image Velocimetry
1.2 Delta Wings
2. Methodology
2.1 Attempt 1
2.2 Attempt 2
2.3 Post Processing
3. Results
3.1 Attempt 1
3.2 Attempt 2
4. Discussion
5. Conclusion
6. References
Appendix I: PIV Algorithm (MATLAB)
Appendix II: Associated MATLAB Functions
IIa. Thresholding Function (thresh.m)
IIb. Function to Determine Displacements to Subpixel Accuracy (subpix.m)
IIc. Function to Check Coherence of Velocity Vectors (checkcoher.m)
IId. Function to Eradicate Vectors with Unsuitable Coherence (errwild.m)
3 3 3 5 5 7 7 9 9 10 12 14 15 16 20 20 20 21 22

1. Introduction
The uid behaviour around a delta wing produces some very interesting phenomena. Of particular signicance is the pattern of vortices shed from the upper surface, at subsonic speeds. The vorticity in this region of the ow is hugely signicant to the aerodynamics of the delta wing and the ability to view and quantify this is essential. One of the advanced experimental methods to accomplish such a task is by the use of Particle Image Velocimetry (or PIV). This report describes an experimental analysis carried out on a delta wing model using Digital PIV, with the aim of evaluating the technique. The vortices shed from the leading edge will be studied at a single angle of attack. The errors encountered throughout the process will be discuss and possible improvements suggested.

1.1 Particle Image Velocimetry


There are several instances in uid mechanics where it is desirable to visualise the behaviour of the uid being studied. The immediate disadvantage of traditional ow visualisation methods, such as smoke ow visualisation, is the qualitative nature of the techniques, in that no numerical data is obtained. PIV, however, is an optical method, that allows instantaneous velocity data to be obtained throughout an area of interest. The method involves introducing a seeding particle to the ow, of suitable diameter such that it faithfully follows the ow throughout. Two near instantaneous images can then be obtained of the ow in a specic area of interest, with a laser pulse illuminating the seeding particles. The images can then be compared using a cross-correlation technique in order for velocity data to be obtained over the area of interest. PIV has the advantage of being a non-intrusive analysis technique, in that it does not require equipment to be placed within the ow. This is not the case with techniques such as hot wire anemometry and the use of pressure probes.

1.2 Delta Wings


Delta wing planforms were rst developed in the mid 20th century along with the rst supersonic aircraft. They are characterised by their high sweep angle and triangular planform. It has well been established that, at low speeds, leading edge vortex separation occurs (Anderson 2007). It is of great importance that the ow behaviour at low speeds is fully understood, given that not only do all aircraft operate in such a regime at both take off and landing but most, with perhaps the exception of Concorde, which cruised supersonically, spend most of their time at this speed. Most high speed military aircraft, for example, spend most of their ight time at subsonic speeds, accelerating to supersonic speeds for only short periods, depending on the mission. Figure 1.1 illustrates the kind of ow pattern that can be expected from this experiment. The vortices form almost immediately after the leading edge. A simple smoke ow visualisation was carried out on a similar model as a prerequisite to this experiment. The image in Figure 1.2 shows the vortex produced over the semi span of the model, when viewed in the chordwise direction. During this test the vortices were shown to be relatively Reynolds Number independent.

Figure 1.1: Smoke Flow Visualisation of Delta Wing Vortex (Charles Williamson, Cornell University)

Figure 1.2: Smoke Flow Visualisation of a Delta Wing Vortex

2. Methodology
2.1 Attempt 1
The PIV experiment was setup in The University of Glasgows 1.15m x 0.95m, closed return, low speed Wind Tunnel. A plan of the delta wing model used is shown in Figure 2.1. The model was mounted such that its angle of attack could be adjusted with precision. It was set at 10 in this case.

Figure 2.1: Schematic of the Delta Wing Model A frequency doubled, double-pulsed Nd:YAG laser was situated above the wind tunnel, with appropriate mirrors and lens, such that a sheet of light was projected onto the area of interest, in this case the mid chord position, over half of the wing. A high resolution (2048x2048 pixel), 10 bit, digital camera was mounted on a tripod in the wind tunnel just aft of the model. A schematic of the entire setup is given in Figure 2.2. The lens was adjusted such that the focus was on the area of interest of the wing. This was done using a specically manufactured plate, which incorporates an array of drilled holes, of known diameter with known spacing.

Laser Lightsheet

Model

Flow Camera
Figure 2.2: Experimental Setup

Flow

Simple calibration of the equipment was then done using this plate. The distance between the holes, in terms of pixels, was determined by inspection of the onscreen image. This was compared to the known values to produce a calibration factor in millimetres per pixel. Further focusing of the lens was carried out by releasing seeding particles into the tunnel. The images of the illuminated area of interest were viewed on screen. Focussing was deemed adequate. Before the experimental procedure begun, a note of the atmospheric conditions within the lab were taken. It was decided that the velocity of the wind tunnel would be set at 10ms-1. In order to achieve this, the pressure difference between the settling chamber and the working section was recorded as the fan speed was increased. It is known that this value is related to velocity by Equation 2.1.
Pset Pwork = Kq

(2.1)

Given, that a manometer measured this pressure difference in millimetres of H2O, Equation 2.1 was U = 3.671 hmmH2 O . rearranged such that the wind tunnel speed,

At this stage seeding was added to the tunnel in the form of Shell Ondina E.L. oil vaporised by a smoke generator located within the settling chamber. The process of data gathering commenced, with the delay between pulses 50s. The PIV software in the lab allowed for correlation of data on the y. On viewing this data as the experiment progress it was obvious that there were problems with the experimental setup; the expected ow patterns were not present. To try to resolve these problems and produce useful data several parameters were adjusted. Initially the pulse delay was increased to 60s initially and again to 70s. Further to this the angle of attack of the wing was increased to 15. Further to these adjustments the wind tunnel speed was reduced to 7.3 ms-1. It was apparent throughout this experiment that glare from the wing surface was a signicant problem and would affect the results signicantly. It was decided to run the experiment again with a slightly different setup. This will be described in the next section.

2.2 Attempt 2
The setup was adjusted so that the camera view grazed the surface of the wing, as shown in Figure 2.3.

Camera

Model Flow

Figure 2.3: Setup of Attempt 2 A small adjustment was made to the lightsheet thickness, increasing it from the 2mm used previously to 2.5mm. The tunnel was run after all calibration described in Section 2.1 was completed. Monitoring, of the live cross correlation, showed promising results.

2.3 Post Processing


Once the image data, captured during the experiments, were stored as TIFF les. As digital PIV was used, a separate image was produced at each laser pulse. It was, therefore, possible to use a cross correlation method to identify the displacement of the ow between pulses. The post-processing code initially split each image up into 64x64 pixel tiles. Each tile was then subject to a simple lter to improve the signal-to-noise ratio. The method used was to subtract the minimum value of the image from the overall image then to further subtract 0.7 of the mean value. Negative values were simply set to zero. To save on computation time the conjugate multiplication of both the tiles Fourier Transforms was taken (Equation 2.2), as opposed to the direct cross-correlation.
R(i , j ) = F F T 1 [(F F T (I1 ) ) F F T (I2 )]

(2.2)

This method produced a integer pixel displacement of uid for each tile. This data was then fed in to a 3Point Gaussian Peak Fit algorithm to produce displacements of subpixel accuracy. The velocity components, u and v, were obtainable by simply converting the subpixel i and j displacements to real x and y displacements, using the correction factor obtained earlier, and dividing by the time delay. In order to eradicate wild vectors a coherence factor was obtained for each velocity component by using Equation 2.3. Velocity components with unacceptable coherence were replaced by the average of the values in the surrounding tiles.
7

C=

8 i=1

|ui u| |ui |

8 i=1

(2.3)

The data produced by experiment attempt one was subject to another lter to remove all erroneously large velocity vectors present as a result of the interference of glare. The vorticity of the vector eld was obtained easily by calculating its curl, U =
v u . x y

In order to insure the accuracy of the algorithm developed to process the results of these PIV experiments, a synthetic image was loaded into the software. These images were developed articially and represent a known ow eld. In this case, the algorithm output the expected results.

3. Results
3.1 Attempt 1
The raw velocity, to integer pixel accuracy, obtained from the rst attempt at this experiment is displayed in Figure 3.1.

Figure 3.1: Unprocessed Velocity Field (Attempt 1, Wild Vectors Highlighted) After applying a further lter to remove the erroneous vectors present as a result of glare, especially apparent in the lower right, and eliminating the vectors of unacceptable coherence (circled in Figure 3.1), the velocity eld shown in Figure 3.2 was produced.

Figure 3.2: Processed Velocity Field (Attempt 1) Due to the incomplete dataset, further analysis was not carried out.
9

3.2 Attempt 2
The raw velocity data obtained from attempt 2 is displayed in Figure 3.3.

Figure 3.3: Unprocessed Velocity Field (Attempt 2, Wild Vectors Highlighted) The wild vectors, highlighted in Figure 3.3, were eradicated by averaging to produce the rened velocity eld in Figure 3.4.

Figure 3.4: Processed Velocity Field (Attempt 2)

10

Vorticity data was then added to this plot to produce Figure 3.5.

Figure 3.5: Vorticity Contours (Attempt 2) Further to this, the ow streamlines were calculated as shown in Figure 3.6.

Figure 3.6: Streamlines (Attempt 2)

11

4. Discussion
This series of experiments helped to prove the relevance of PIV within the eld of modern experimental aerodynamics. The results show how relatively simple it is to obtain detailed velocity data from even the most complex of ow patterns. The results in presented in Section 3.2 relate closely to what would be expected from such an experiment and described by Anderson (2007). The primary vortex, in the bottom right of the area of interest, is very apparent in Figure 3.5 as well as a smaller secondary vortex to its left. Many shortcomings of the method were, however, also apparent. Although the algorithm used to post process the data in this case was validated against synthetic images, there are a number of inherent inaccuracies associated with PIV and in particular with Digital PIV. These will be discussed here. Several methods of, at least partially, overcoming such shortcomings will also be discussed. In attempt one the validity of the data was highly compromised as a result of glare from the wing model. This reected light obscured the particle locations from the camera causing substantial data loss. Erroneous data is obvious in Figure 3.1 and after some additional ltering the extent of the data lost to glare is apparent in Figure 3.2. The experiment set up was adapted slightly, such that the camera was at the same incidence as the wing for Attempt 2. This resulted in a highly improved data set being obtained as shown, after renement, in Figure 3.4. Any surface at incidence to the axis of the camera is likely to cause problems during this type of experiment, limiting the models that can be studied. Fortunately, in this case, a simple solution was available. As this experiment was intended to simply gauge to the possibilities of DPIV, the level of accuracy of the data obtained was not of signicant importance. As this was the case, only a crude calibration method was carried out. This assumed that the same calibration factor could be applied throughout the image and did not take into account any image distortion caused by the camera or lens. It was observed during the calibration process that there was no signicant deviation from the correction factor anywhere in the image and it was decided that no image manipulation was required. In order to improve the accuracy of the results obtained. A system should be used whereby local transfer function is obtained for data points throughout the area of interest. One of the drawbacks of PIV in aerodynamics is the difculty to nding a seeding particle that is small enough so that it follows the ow faithfully, whilst being large enough to possess good light scattering properties. In this case the particle diameter was 2m, which has been shown to be a suitable compromise between both properties (Melling 1997). It is imperative that the laser strength is constant for both pulses, ensuring that each particle is imaged the same on each exposure. For this experiment this parameter was not measured and as a result the equality of the pulse strengths cannot be guaranteed in this case, which may lead to problems when it comes to cross correlation. One nal notable random error affecting the results is wind tunnel wall interference, which can only realistically be overcome by using a a larger wind tunnel or a smaller model. Neither of these options were feasible in this case, due to the equipment available. The major source of error in PIV is the bias errors that result from the fundamental inaccuracies of the method. The rst of these to be discussed is the dependance of the outcome of the cross-correlation method on the size of the tile that is being analysed. If the tile size is set too small then, the chances are, a large proportion of particles will move out of the tiles between exposures causing a large amount of wild vectors being produced. On the other hand, if the tile size is set too small, the variation of velocities throughout the will not be considered producing a smaller amount of data that is increasingly erroneous in areas of large velocity gradient.
12

pattern correlation as only one particle has wandered out of the tile between exposure Green et al. developed this basic notion by using the results from three sets of crosscorrelations to determine if a velocity measurement was valid, with the idea that suppression of into and out-of tile particle motion effects would increase reliability of measurement. produce the most accurate data, using the were evaluated as follows: A compromise must be sought to The three sets of cross-correlationsmaximum particle displacement (i) the ce as a guide (this vector,be less than half the tile size). Further improvements to the (the central tile); (ii) the reverse should evaluated at the desired measurement position cross correlation process can reduce the vector;of wild vectors produced. One method of doing this,to the central tile by the opposite of amount evaluated at a tile location shifted relative known as forward/reverse tile testing (FRTT),central vector displacement; (iii)to perform further cross-correlation calculations on developed by Green et al. (2000) is the forward vector, evaluated at a tile location shifted further tiles which are displaced from the original in proportion to thevector displacement. Figure 2.33 illustrates relative to the central vector by the central displacement present in both directions directions (Figure 4.1). These extra calculations provide validation for each vector. relative tile locations.
reverse tile central tile central vector forward tile

Figure 2.33

Figure 4.1: Illustration of FRTT Central, forward and reverse tile locations (R. Green, University of Glasgow)

The forward and reverse tile positions camera (i.e. DPIV) as opposed to traditional Finally, errors are likely to be accrued due to the use of a digitalcan only be evaluated once the central tile cros correlation has are limited by the the amount of pixels present on a CCD chip the central tile C wet lm methods. Digital cameras been done, and nite two new tiles very closely overlap(~4.2M correlations are then performed at are new tile (~2m) in and the the area of in this case). When the diameter of the seeding particles the considered locations, relation tothree results compar with one another. The single at the will not analysis location using this set up. interest (~12cmx12cm) it is obvious that avectorparticle desiredbe imaged accurately (i.e the central vector) wa This results inclassified as follows (with referencedisplacement producedfigure 2.34, which shows the ve a bias towards integer values of pixel to figure 2.33 and by cross correlation, a phenomenon known as peak locking. To counter this problem a Gaussian Peak Fitting interpolation method classifications): was applied to the data. (i) Type I vector, where all three vectors agree to within the specified tolerance.

It is worth pointing out that the use of wet lm imaging, whilst eradicating peaking locking, has its own considerable disadvantages. Firstly, it is near impossiblecentral vectorseparate exposures inof the other two to wit (ii) Type II vector, where the to produce two agrees with one the short time necessary, which meansthe tolerance, but agreement with the other is of the post processing. This a multi exposure is required, increasing the complexity poor. coupled with the time it takes to develop a wet lm (up to an hour) added to the time required to digitally scan the image (a further hour at least) makes it clear why DPIV has become almost universally used.

(iii) (iv)

Type III vector, where the forward and reverse vectors agree with each other to within the tolerance, but not with the central vector. Type IV vector, where none of the vectors agree with each other to within the tolerance.

This procedure was referred to as the Forward/ Reverse Tile Test (FRTT). Vectors of t I and II are deemed to be satisfactory; a vector of type III is replaced with the average the forward and reverse tile displacement results; a vector of type IV is replaced with cross-correlation based on the central tile position but of twice the original size (this la tile size will tend to give a more reliable measurement, but is still not necessarily cor

48

13

5. Conclusion
The experiment showed the advantages and detail of results obtainable from a well thought out PIV experiment over other experimental techniques such as the use of hot wires and pressure probes. It is clear, however, that the immediate results should not be taken at face value given the amount of errors, particularly bias errors when using DPIV. The experiment also highlighted the problem of glare, causing irrecoverable data loss to the results. This possibility must be taken into account when setting the camera position. It also limit the usefulness of PIV to models of fairly low complexity. In this case, the results of the second attempt at the experiment correlated nicely with the ow conditions widely known to exist on delta wings. Strong vortices were formed on the sharp leading edges of the wing which then broke down into weaker secondary vortices.

14

6. References
Anderson, J. 2007 Fundamentals of Aerodynamics. McGraw-Hill. Green, R.B., Doolan, C.J., Cannon, R.M. 2000 Measurements of the Orthogonal Blade-Vortex Interaction Using a Particle Image Velocimetry Technique. Exp. Fluids, 29, p369-379 Melling, A. 1997 Tracer Particles and Seeding for Particle Image Velocimetry. Meas. Sci. Technol., 8, p1406-1416

15

Appendix I: PIV Algorithm (MATLAB)


clear all clc close all % INPUTS******************************************************* % ************************************************************* im1 = imread('10deg50_00','tiff'); im2 = imread('10deg50_01','tiff'); [pixj pixi] = size(im1); % read image 1 % read image 2 % pixels in i direction % pixels in j direction % filter intensity % tile size (px) % time delay in sec % mm per pix % coherence threshold

filter = 50; tsize = 64; delt = 50e-6; corf = 0.058; cothre = 1.1;

% CHECK IMAGE DIMENSIONS % ************************************************************* if pixi~=pixj fprintf('IMAGES MUST BE SQUARE') elseif size(im1)~=size(im2) fprintf('IMAGES MUST BE OF EQUAL SIZE') end im1n=im1-uint16(ones(size(im1))*2^15); %im1n = im1; im1n = double(im1n); im2n=im2-uint16(ones(size(im2))*2^15); %im2n = im2; im2n = double(im2n); % process image 1 % convert to double % process image 2 % double precision

% SPLIT IMAGE INTO TILES AND APPLY THRESHOLD FUNCTION h=0; for i = 1:tsize:(pixj-(tsize-1)); for j = 1:tsize:(pixi-(tsize-1)); h=h+1; dat1 = double(im1n(i:i+(tsize-1),j:j+(tsize-1))); dat1 = thresh(dat1); tiledat1.(['t',num2str(h)])=dat1; dat2 = double(im2n(i:i+(tsize-1),j:j+(tsize-1))); dat2 = thresh(dat2); tiledat2.(['t',num2str(h)])=dat2; clear dat1 dat2 end
16

end % PERFORM X-CORELATION mm = zeros(1,((pixi/tsize)^2)); nn = zeros(1,((pixj/tsize)^2)); for k = 1:((pixi/tsize)^2); cor.(['t',num2str(k)]) = fftshift(real(ifft2(fft2(tiledat1. (['t',num2str(k)])).*conj(fft2(tiledat2.(['t',num2str(k)])))))); B = max(max(cor.(['t',num2str(k)]))); [g,h] = subpix(cor.(['t',num2str(k)]),tsize,1,1); s(k) = h; t(k) = g; mm(k) = (h(1)-0.5)-(tsize/2); nn(k) = (g(1)-0.5)-(tsize/2); end points = ((tsize/2)*corf):(tsize*corf):((pixi-(tsize/2))*corf); % set up coordinate points % POPULATE COORDINATE ARRAY FOR TILE CENTROIDS for a = 1:(pixj/tsize) y(((a-1)*(pixj/tsize)+1):(a*(pixj/tsize))) = points(a); for b = 1:(pixi/tsize) x(((b-1)*(pixi/tsize)+1):(b*(pixi/tsize))) = points; end end ti = pixi/tsize; tj = pixj/tsize; % CONVERT TO SI x y x y = = = = x/1000; fliplr(y/1000); (reshape(x,tj,ti))'; (reshape(y,tj,ti))';

%Correct displacements deli = corf*nn; delj = corf*mm; % Compute Velocities u = -(deli/delt)/1000; v = (delj/delt)/1000; % FIND WILD VECTORS USING COHERENCE FACTOR u2 = (reshape(u,tj,ti))'; v2 = (reshape(v,tj,ti))'; [Cu,Cv] = checkcoher(u2,v2); [Cuej, Cuei] = find(Cu > cothre); [Cvej, Cvei] = find(Cv > cothre); Cueip = ((tsize/2)+((Cuei-1)*tsize))*corf/1000; Cuejp = tj-Cuej+1; Cuejp = ((tsize/2)+((Cuejp-1)*tsize))*corf/1000; Cveip = ((tsize/2)+((Cvei-1)*tsize))*corf/1000;
17

Cvejp = tj-Cvej+1; Cvejp = ((tsize/2)+((Cvejp-1)*tsize))*corf/1000; figure, hold on quiver(x,y,u2,v2),plot(Cueip,Cuejp,'ko'),plot(Cveip,Cvejp,'bo') title('Velocity Field of Raw Data (Vectors with Unacceptable Coherence Highlighted)') xlabel('meters'),ylabel('meters') axis image hold off % FILTER BAD DATA CAUSED BY GLARE (TO BE USED IN CASES WHERE GLARE IS A % PARTICULAR PROBLEM) % for i=1:length(u2) % for j=1:length(u2) % if abs(u2(i,j)) > 20 % u2(i,j)=0; % end % if abs(v2(i,j)) > 17 % v2(i,j)=0; % end % end % end % ERRADICATE WILD VECTORS USING AVERAGING u3 = errwild(u2,Cuej,Cuei); v3 = errwild(v2,Cvej,Cvei); figure, hold on quiver(x,y,u3,v3,1.3) title('Velocity Field of Processed Data') xlabel('meters'),ylabel('meters') axis image hold off % PLOT VORTICITY dx = x(1,2)-x(1,1); dy = y(2,1)-y(1,1); [m,n] = size(u3); dv_dx = zeros(size(v3)); du_dy = zeros(size(u3)); % LOOP TO DETERMINE VORTICITY FOR INNER AREA (LEAST SQUARES) for i = 1:m for j = 3:n-2 dv_dx(i,j) = ((2*v3(i,j+2))+v3(i,j+1)-v3(i,j-1)-(2*v3(i,j-2)))/ (10*dx); du_dy(j,i) = ((2*u3(j+2,i))+u3(j+1,i)-u3(j-1,i)-(2*u3(j-2,i)))/ (10*dy); end end
18

% LOOP TO DETERMINE VORTICITY FOR OUTER AREA (FINITE DIFFERENCE) vte = dv_dx; ute = du_dy; vortest = dv_dx - du_dy; for i = 1:m for j = 2:-1:1 dv_dx(i,j) du_dy(j,i) end for j = n-1:n dv_dx(i,j) du_dy(j,i) end end

= (v3(i,j+1)-v3(i,j))/dx; = (u3(j+1,i)-u3(j,i))/dy;

= (v3(i,j)-v3(i,j-1))/dx; = (u3(j,i)-u3(j-1,i))/dy;

vort = dv_dx - du_dy; xp = x(3:n-2,3:m-2); yp = y(3:n-2,3:m-2); vortp = vort(3:n-2,3:m-2); figure, hold on contourf(xp,yp,vortp,100),colorbar, shading flat quiver(x,y,u3,v3,'k'), title('Vorticity') xlabel('metres'),ylabel('metres'),zlabel('1/s') axis('image') hold off %PLOT STREAMLINES figure, hold on title('Streamlines') xlabel('metres'),ylabel('metres') streamslice(x,y,u3,v3,3) hold off

19

Appendix II: Associated MATLAB Functions


IIa. Thresholding Function (thresh.m)
function image=thresh(image) %imout=thresh(imin) %threshold image by removing 0.7*mean and set negative values to zero [r,c]=size(image); tolt=0.7; image=image-min(min(image)); image=image-tolt*mean(mean(image)); for i= 1:r, for j=1:c, if (image(i,j) < 0 ) image(i,j)=0; end end end

IIb. Function to Determine Displacements to Subpixel Accuracy (subpix.m)


function [xs,ys]=subpix(res,tsiz,nr,nc); %#realonly %extract the area around the correlation peak % com=0 ; %centre of mass peak finding algorithm or 3-point Gaussian res=real(res); if (com) %centre of mass % B=max(max(res(3:tsiz-2,3:tsiz-2))); [mm,nn]=find(res==B); m=max(mm); %to fix a problem! n=max(nn); Z(1:5,1:5)=res(m-2:m+2,n-2:n+2); %find the centroid of the matrix obtained from above C = sum(Z,2); I = m-2:m+2; E = I*C; ys = E/(sum(sum(Z))); D = (sum(Z,1))'; J = n-2:n+2; F = J*D; xs = F/(sum(sum(Z))); % else % 3-point Gaussian peak fit B=max(max(res(2:tsiz*nr-1,2:tsiz*nc-1))); [mm,nn]=find(res==B); m=max(mm); %to fix a problem! n=max(nn); Z(1:3,1:3)=res(m-1:m+1,n-1:n+1);
20

A=log(Z(1,2))-log(Z(3,2)); B=2*log(Z(1,2))-4*log(Z(2,2))+2*log(Z(3,2)); C=log(Z(2,1))-log(Z(2,3)); D=2*log(Z(2,1))-4*log(Z(2,2))+2*log(Z(2,3)); xs=n+C/D; ys=m+A/B; if ((xs>tsiz*nc) | (ys>tsiz*nr)) xs=0; ys=0; end end

IIc. Function to Check Coherence of Velocity Vectors (checkcoher.m)


function [Cu,Cv] = checkcoher(u,v) % Determine coherence for each velocity component following % Noguiera et al (1997) pix = (length(u)); Cu = zeros(pix,pix); Cv = zeros(pix,pix); for j=2:(pix-1) for i=2:(pix-1) Cu(j,i) = (abs(u(j-1,i-1) - u(j,i)) +... abs(u(j-1,i) - u(j,i)) +... abs(u(j-1,i+1) - u(j,i)) +... abs(u(j,i-1) - u(j,i)) +... abs(u(j,i+1) - u(j,i)) +... abs(u(j+1,i-1) - u(j,i)) +... abs(u(j+1,i) - u(j,i)) +... abs(u(j+1,i+1) - u(j,i)))/... (abs(u(j-1,i-1)) + abs(u(j-1,i)) +... abs(u(j-1,i+1)) + abs(u(j,i-1)) +... abs(u(j,i+1)) + abs(u(j+1,i-1)) +... abs(u(j+1,i)) + abs(u(j+1,i+1))); Cv(j,i) = (abs(v(j-1,i-1) - v(j,i)) +... abs(v(j-1,i) - v(j,i)) +... abs(v(j-1,i+1) - v(j,i)) +... abs(v(j,i-1) - v(j,i)) +... abs(v(j,i+1) - v(j,i)) +... abs(v(j+1,i-1) - v(j,i)) +... abs(v(j+1,i) - v(j,i)) +... abs(v(j+1,i+1) - v(j,i)))/... (abs(v(j-1,i-1)) + abs(v(j-1,i)) +... abs(v(j-1,i+1)) + abs(v(j,i-1)) +... abs(v(j,i+1)) + abs(v(j+1,i-1)) +... abs(v(j+1,i))+abs(v(j+1,i+1))); end end

21

IId. Function to Eradicate Vectors with Unsuitable Coherence (errwild.m)


function [u] = errwild(ui,x,y) u = ui; for i=1:length(x) u(x(i),y(i)) = (ui(x(i)-1,y(i)-1) + ui(x(i),y(i)-1) + ui(x(i)+1,y(i) +1) +... ui(x(i)-1,y(i)) + ui(x(i)+1,y(i)) +... ui(x(i)-1,y(i)+1) + ui(x(i),y(i)+1) + ui(x(i)+1,y(i) +1))/8; end

22

Вам также может понравиться