Backward Difference Table in MATLAB | M-file
MATLAB Code:
% taking all the necessary inputs %
x1=input('Enter
starting value of x:  ');
h= input('Intervel:  ');
x2=input('Ending
value of x:  ');
x=x1:h:x2;
[c,n]=size(x); %
counting the number of elements using SIZE command %
for
i=1:n
    y(i,1)=input('Enter corresponding values of
y:  ');
end
for
j=2:n
    for i=j:n
       
y(i,j)=y(i,j-1)-y(i-1,j-1); % formula to calculate backward difference
    end
end  
% print backward difference table
fprintf('\n******backward
difference formula table****');
fprintf('\n\tx\t    y\t');
for
i=1:n
    fprintf('\n   %.f',x(i));
    for j=1:i
        fprintf('\t   %.4f',y(i,j));
    end
end
Free Codes: youtube.com/castorclasses
Free Support: castorclasses2014@gmail.com
Live Support: t.me/matlabirawen
Like us: https://www.facebook.com/matlabirawen
Join us: https://www.facebook.com/groups/MATLA...
MATLAB Book for the beginner: https://amzn.to/3fTfmTa
 
 
 
 
 
 
 
%206th%20Edition,%20Kindle%20Edition.jpg) 
 
 
 Posts
Posts
 
 
 
 
 
 
 
 
No comments