lfev.c 754 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "local.h"
  2. int lf_error;
  3. lfit lf;
  4. design des;
  5. void calllf(x,y,n)
  6. double *x, *y;
  7. int n;
  8. { lfdata *lfd;
  9. fitpt *fp;
  10. int i;
  11. lfit_init(&lf);
  12. lfd = &(lf.lfd);
  13. lfd->x[0] = x;
  14. lfd->y = y;
  15. lfd->n = n;
  16. lfd->d = 1;
  17. startlf(&des,&lf,procv,1);
  18. // startmodule(&lf,&des,"std",0);
  19. fp = &lf.fp;
  20. for (i=0; i<fp->nv; i++)
  21. printf("%8.5f %8.5f\n",evptx(fp,i,0),fp->coef[i]);
  22. }
  23. int main()
  24. { double x[10], y[10];
  25. x[0] = 0; x[1] = 1; x[2] = 2; x[3] = 3; x[4] = 4;
  26. x[5] = 5; x[6] = 6; x[7] = 7; x[8] = 8; x[9] = 9;
  27. y[0] = 0.3692449; y[1] = 0.8194270;
  28. y[2] = 1.6363139; y[3] =-0.9969944;
  29. y[4] = 0.5359200; y[5] = 1.8642622;
  30. y[6] = 0.3568127; y[7] = 0.4746753;
  31. y[8] =-2.0038246; y[9] = 1.6636109;
  32. calllf(x,y,10);
  33. }