Professional Documents
Culture Documents
Ftcs Rahmat S.
Ftcs Rahmat S.
=
=
=
=
=
=
=
=
=
0.000217;
40;
0.001;
0.00232;
0.040;
1.2538;
v*delta_t/(delta_y).^2;
round(y_maks/delta_y)+1;
round(t_maks/delta_t)+1;
%Kondisi awal
for j = 1 : j_maks - 1
u(1,1)
= u0;
u(j+1,1) = 0;
(j,n)=(j+1,1)
end
%Syarat Batas
for n = 1 : n_maks - 1
u(1,n+1)
= u0;
u(j_maks,n+1) = 0;
(j,n)=(j_maks,n+1)
end;
% t=0 bearti n = 1
% u = u0 untuk (y,t) = (0,0) atau (j,n)=(1,1)
% u = 0 untuk 0<y<=y_maks atau 1<j<=j_maks-1/
%Proses FTCS
for n = 1 : n_maks-1
for j = 2 : j_maks-1
u(j,n+1) = u(j,n)+d*(u(j+1,n)-2*u(j,n)+u(j-1,n));
end
end
%plot u
a = [1 : fix(0.21/delta_t) : n_maks]
for k = 1:length(a)
y = 0:delta_y:y_maks;
bentuk_gambar = ['s';'v';'^';'d';'>';'<';'*'];
warna_garis = ['k';'k';'k';'k';'k';'k';'k'];
u_plot = u(:,a);
uu = u_plot(:,k);
gambar(k) =
plot(u(:,a(k)),y',strcat(bentuk_gambar(k),'-',warna_garis(k)));
hold on;
xlabel('u (m/s)');
ylabel('y (m)');
Title('Figure 3-8. delta_y = 0.001, delta_t = 0.00232.');
set(gca,'xlim',[-5 45],'ylim',[-0.01 0.06]);
set(gambar,'MarkerSize',4.5);
tleg = legend('t = 0.00 (sec)','t = 0.21 (sec)','t = 0.42 (sec)','t =
0.63 (sec)','t = 0.84 (sec)','t = 1.04 (sec)','t = 1.25 (sec)');
set(tleg);
end
u_plot