I am trying to estimate the FD stencil for boundary as mentioned in this paper (section 4.1) using MATLAB. The stencil order (6th) is higher than the one mentioned in paper (4th). $$ f_1' +\alpha f_2' = \frac{1}{h} (c_1f_1 + c_2f_2 + c_3f_3 +c_4f_4+ c_5f_5 + c_6 f_6 + c_7 f_7 )$$ Each term of both sides is expanded using Taylor series expansion and then derivatives are matched to estimate the coefficients [$c1,c2,c3,c4,c5,c6,c7$ and $\alpha$].

I solved the above system as following: enter image description here

Above system of equation can be written as M*x=y


1) The alpha was taken to the left to form a part of unknown vector x

2) the factorial on both side were simplified and adjusted to right side.

I wrote following code for solving the above system of equation.

LM = zeros(8);                
LM(1,1:7)=1;                LM(1,8)=0;  
LM(2,2:7)=1:6;              LM(2,8)=-1;
LM(3,2:7)=(1:6).^2;         LM(3,8)=-2;
LM(4,2:7)=(1:6).^3;         LM(4,8)=-3;
LM(5,2:7)=(1:6).^4;         LM(5,8)=-4;
LM(6,2:7)=(1:6).^5;         LM(6,8)=-5;
LM(7,2:7)=(1:6).^6;         LM(7,8)=-6;
LM(8,2:7)=(1:6).^7;         LM(8,8)=-7;

which gives completely different answer than reported one. Both are given below:

Solution i.e. $x =[c1,c2,c3,c4,c5,c6,c7, \alpha$] by

MATLAB estimated solution: [-69/20, -17/10, 15/2, -10/3, 5/4, -3/10, 1/30, 6]

Solution reported in literature: [-197/60, -5/12, 5, -5/3, 5/12, -1/20, 0, 5]

Any help is appreciated.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.