disp('Enter all values in row vector ');x=input('Enter the values of x=');y=input('Enter the values of function at x f(x)=');val=input('Enter the value of x at which derivative is to be calculated=');i=find(x==val);fd=[y(i+1)-y(i)]/[x(i+1)-x(i)];cd=[y(i+1)-y(i-1)]/[x(i+1)-x(i-1)];bd=[y(i)-y(i-1)]/[x(i)-x(i-1)];disp('Following are the Difference Derivatives')disp(' FDD CDD BDD')disp([fd cd bd])
MATLAB: Why is this code showing zero for all equations?
MATLAB
Best Answer