RUPAK SEARCH ENGINE

Custom Search

Numerical Differentation using Three Point FFD Formula

//Numerical Differentation using Three Point FFD Formula
#include
#include
#define m 10
void main()
{
int i,n,a;
float x[m],f[m],fd[m],h,nd;
printf("\nThis program will give you Derivative at node X using Three Point FFD Formula\n\n");
printf("How many no. of discrete data ? ");
scanf("%d",&n);
for(i=0;i {
printf("Enter Node X%d and Ordinate F%d ",i,i);
scanf("%f %f",&x[i],&f[i]);
}
printf("Enter node: ");
scanf("%f",&nd);
for(i=0;i {
if(x[i]==nd)
{
a=i;
h=x[a+1]-x[a];
fd[a]=(f[a+1]-f[a-1])/(2*h);
}
else
continue;
}
printf("Derivative at %.2f is %.2f\n",x[a],fd[a]);
getch();
}
/*
OUTPUT:
This program will give you Derivative at node X using Three Point FFD Formula

How many no. of discrete data ? 5
Enter Node X0 and Ordinate F0 0 1
Enter Node X1 and Ordinate F1 1 4
Enter Node X2 and Ordinate F2 2 13
Enter Node X3 and Ordinate F3 3 28
Enter Node X4 and Ordinate F4 4 49
Enter node: 2
Derivative at 2.00 is 12.00
*/

No comments:

Post a Comment