How to create a velocity matrix

I want to create a n by n square matrix for velocity Z using the formula below
Z=(2*dP*K'*y*(x-P))/((x-P)^2+y^2))^2
For example, a 3 by 3 matrix will be
Z1=K'(1)P(1)x(1)y(1)+K'(2)P(2)x(1)y(1)+K'(3)P(3)x(1)y(1)
Z2=K'(1)P(1)x(2)y(2)+K'(2)P(2)x(2)y(2)+K'3)P(3)x(2)y(2)
Z3=K'(1)P(1)x(3)y(3)+K'(2)P(2)x(3)y(3)+K'(3)P(3)x(3)y(3)
The size of the matrix follows the npanels=3 value
Vector K',vector P,Vector x and Vector y are row vectors with 3 elements which is the value of npanels=3.
FreeVel=1; %free stream velocity
npanels=3; %number of panels
dP=2.4/npanels; %equal length panels
P=[-1.2+(2.4/npanels)/2:dP:1.2-(2.4/npanels)/2]; %panels x-ccordinates
a=1.25; %major axis
b=0.75; %minor axis
O=[pi-pi/(2*npanels):-pi/(npanels):pi/(2*npanels)]; %boundary points
r=(a*b)./sqrt((b*cos(O)).^2+(a*sin(O)).^2); % ellipse in polar coordinates
x=r.*cos(O); %x-coordinate
y=r.*sin(O); %y-coordinate
v=1:npanels;
C=reshape(cell2mat(arrayfun(@(v)(y(v).*dP)./((x(v)-P).^2+(y(v).^2)),...
v,'uni',false)),npanels,npanels)'; %matrix Cij
K=inv(C)*FreeVel*y'; %doublet densities
Z=(2*dP*K'*y*(x-P))/((x-P)^2+y^2))^2

Réponses (0)

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Produits

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by