0

```
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void estimate(float data[], int n, int m, float *xms, float d[])
int main(void)
{
double data[] =
{
//Loads(~1000) of data vavues between +1 and -1. Ex: -0.15709, -0.25413,...
};
float xms[m];
float float d[m];
for (i=0;i<m;i++)
{
//Function call here to fill xms[] and d[]???
}
void estimate(float data[], int n, int m, float *xms, float d[])
{
int k,j,i,m=20;
float p=0.0, *wk1,*wk2,*wkm;
int n = sizeof(data) / sizeof(data[0]);
wk1 = vector(1,n);
wk2 = vector(1,n);
wkm = vector(1,m);
for(j=1;j<=n;j++)
{
p += data[j]*data[j];
}
*xms = p/n;
wk1[1] = data[1];
wk2[n-1] = data[n];
for (j=2;j<=n-1;j++)
{
wk1[j] = data[j];
wk2[j-1] = data[j];
}
for (k=1;k<=m;k++)
{
float num=0.0,denom=0.0;
for (j=1;j<=(n-k);j++)
{
num += wk1[j]*wk2[j];
denom += wk1[j]*wk1[j] + wk2[j]*wk2[j];
}
d[k]=2.0*num/denom;
xms *= (1.0- d[k]*d[k]);
if (k ==m)
{
free_vector(wkm,1,m);
free_vector(wk2,1,n);
free_vector(wk2,1,n);
return;
}
for (i=1;i<=k;i++) wkm[i]=d[i];
for (j=1;j<=(n-k-1);j++)
{
wk1[j] -= wkm[k]*wk2[j];
wk2[j] = wk2[j+1]-wkm[k]*wk1[j+1];
}
}
}
```

Hi guys,

I'm trying to call the function memcof here to perform a recursive estimation of parameters to describe the information in data[]. My problem is that I'm not great at using functions, especially when arrays and pointers are involved! For the function above, I want to input an array, data[], two ints, m and n, and I need to retrieve the float values for xms and d and store them in two float arrays. Could anyone give me a few pointers??;)

Ger.