Studying Drag
clc
clear
M=100;
N=100;
x(1)=0;
y(1)=0;
LX=1;
LY=1;
dx=LX/M;
dy=LY/N;
for i=1:2*M;
x(i+1)=x(i)+dx
y(i+1)=y(i)+dy
end
for i=1:M;
dtx(i)=rand(1,1)
dty(i)=rand(1,1)
end
for j=1:M
u(j)=(x(j+1)-x(j))/dtx(j)
v(j)=(y(j+1)-y(j))/dty(j)
end
for j=1:M
V(j)=((u(j))^2+(v(j))^2)^0.5
end
plot(x(1:10),V(1:10),'+')
grid on
xlabel('X')
ylabel(' Velocity V')
totaltime=sum(dtx)+sum(dty)
r0=1.29;
for j=1:M;
r(j)=r0+0.001*randn(1,1)
end
cd=0.12;
A=2;
for j=1:M
F(j)=0.5*r(j)*cd*A*(V(j))^2
end
figure(2)
plot(x(1:10),F(1:10),'-*')
grid on
xlabel('Distance on X Axis')
ylabel('Drag Force')
pause(10)
close all
clear
M=100;
N=100;
x(1)=0;
y(1)=0;
LX=1;
LY=1;
dx=LX/M;
dy=LY/N;
for i=1:2*M;
x(i+1)=x(i)+dx
y(i+1)=y(i)+dy
end
for i=1:M;
dtx(i)=rand(1,1)
dty(i)=rand(1,1)
end
for j=1:M
u(j)=(x(j+1)-x(j))/dtx(j)
v(j)=(y(j+1)-y(j))/dty(j)
end
for j=1:M
V(j)=((u(j))^2+(v(j))^2)^0.5
end
plot(x(1:10),V(1:10),'+')
grid on
xlabel('X')
ylabel(' Velocity V')
totaltime=sum(dtx)+sum(dty)
r0=1.29;
for j=1:M;
r(j)=r0+0.001*randn(1,1)
end
cd=0.12;
A=2;
for j=1:M
F(j)=0.5*r(j)*cd*A*(V(j))^2
end
figure(2)
plot(x(1:10),F(1:10),'-*')
grid on
xlabel('Distance on X Axis')
ylabel('Drag Force')
pause(10)
close all
Unless otherwise noted, all content on this site is @Copyright by Ahmed Al Makky 2012-2013 - http://cfd2012.com