12.07.2015 Views

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

25.1 Example: AirfoilSuppose we are doing some finite element modelling <strong>of</strong> the airflow overan aeroplane wing. In finite element modelling you set up a calculationgrid whose points are more densely spaced where the solution has highgradients. A suitable set <strong>of</strong> points is contained in the file airfoil:load airfoilclfplot(x,y,’.’)There are 4253 points distributed around the main wing <strong>and</strong> the tw<strong>of</strong>laps. In carrying out the calculation, we need to define the network <strong>of</strong>interrelationships among the points; that is, which group <strong>of</strong> points willbe influenced by each point on the grid. We restrict the influence <strong>of</strong>a given point to the points nearby. This information is stored in thevectors i <strong>and</strong> j, included in the loaded data. Suppose all the points arenumbered 1, 2,... ,4253. The i <strong>and</strong> j vectors describe the links betweenpoint i <strong>and</strong> point j. For example, if we look at the first five elements:>> [i(1:5) j(1:5)]’ans =1 2 3 5 42 310 10 11The interpretation is that point 1 is connected to point 2, point 2 isconnected to point 3, points 3 <strong>and</strong> 5 are connected to point 10, <strong>and</strong> soon. We create a sparse adjacency matrix, A, by using i <strong>and</strong> j as inputsto the sparse function:A = sparse(i,j,1);spy(A)The spy function plots a sparse matrix with a dot at the positions <strong>of</strong>all the non-zero entries, which number 12,289 here (the length <strong>of</strong> the i<strong>and</strong> j vectors). The concentration <strong>of</strong> non-zero elements near the diagonalreflects the local nature <strong>of</strong> the interaction (given a reasonable numberingscheme). To plot the geometry <strong>of</strong> the interactions we can use the gplotfunction:c○ 2000 by CRC Press LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!