You are on page 1of 2

FIRST ORDER DIFFERENCE EQUATION

#include<stdio.h>

#include<math.h>

float y[10];

void main()

float x[10],a[10],b[10];

int k,n;

prinf("enter coefficients b");

for(n=0;n<1;n++) //range depends on the


number of coefficients

scanf("%f",&b[n]);

prinf("enter coefficients a");

for(n=0;n<2;n++) //range depends on the


number of coefficients

scanf("%f",&a[n]);

for(n=0;n<10;n++)

x[n]=pow(0.9,n); //given input response

printf("enter the initial condition");

for(n=0;n<1;n++)

scanf("%d",&k);

for(n=0;n<10;n++)

if(n==0);

y[n]=(b[0]*x[n]-a[1]*k)/a[0];

else

y[n]=(b[0]*x[n]-a[1]*y[n-1])/a[0];
printf("y[%d]=&f\n",n,y[n]);

You might also like