function[f] = compactdiffcaboct(V,h2); % function to generate values of f using compact difference scheme % calling sequence % [f] = compactdiffcaboct(V,h2) % define variables % V1 -- function V1 generated at different points x1 by using function % h21 -- h1*h1 ( where h is discretization interval ) h1 = 2/(n1-1) % a -- coeff for boundaries % b -- coeff for boundaries % c -- coefffor boundaries % d -- coeff for boundaries % e -- coeff for boundaries % alpha -- compact diff coeff % alpha1 -- compact diff coeff % A -- coeff forother points % A1 -- coeff for other points % B -- coeff for other points % C -- coeff for other points % f -- R.H.S of equation Ax = B % N1 -- number of points of space discretization % ii -- index variable % record of revisions % date Programmer Description of changes % June 1, 2007 Asha G original code % declare global values global N pack ('compactdiffcaboct') alpha = 2/11; alpha1 = 1/10; beta = 0; % boundaries a = (( 11* alpha) + 35)/12; b = -(( 5* alpha) +26)/3; c = (alpha+19)/2; d1 = (alpha -14)/3; ee = (11-alpha)/12; % other points: A = 12/11; A1 = (4/3)* (1-(alpha1)); B = 3/11; C = 0; f = zeros(1,N); for ii = 3:(N-2) f(ii) = (B*(V(ii+2) -2*V(ii) +V(ii-2)))/(4*h2) + (A*(V(ii+1) -2*V(ii) +V(ii-1)))/h2; endfor f(1) = (a*V(1))+(b*V(2))+(c*V(3))+(d1*V(4))+(ee*V(5))/h2; f(N) = (a*V(N)+ b* V(N-1) +c* V(N-2)+ d1*V(N-3) + ee* V(N-4))/h2; f(2) = (A1*(V(3)-2*V(2) +V(1)))/h2; f(N-1) = (A1*(V(N)-2*V(N-1) +V(N-2)))/h2; end % function compactdiffcaboct