blob: 63e8e5a44fc3213718ee2251f1a0a71993d55275 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
//Example No. 15_07
//Hyperbolic Equations
//Pg No. 500
clear ; close ;clc ;
h = 1
Tbyp = 4
tau = sqrt(h^2 /4)
r = 1+(2.5 - 0)/tau
c = 1+(5 - 0)/h
for i = 2:c-1
f(1,i) = (i-1)*(5 - (i-1) )
end
f(1:r,1) = 0
f(1:r,c) = 0
for i = 2:c-1
g(i) = 0
f(2,i) = (f(1,i+1) + f(1,i-1))/2 + tau*g(i)
end
for j = 2:r-1
for i = 2:c-1
f(j+1,i) = -f(j-1,i) + f(j,i+1) + f(j,i-1)
end
end
disp(f,'The values estimated are ')
|