Solving Problem in Fortran Program - Bevington Polyfit.f

  • Context: Fortran 
  • Thread starter Thread starter akila
  • Start date Start date
  • Tags Tags
    Fortran
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
akila
Messages
1
Reaction score
0
hi all,

greetings,
i have a fortran prg to fit 2nd order polynomial to my data
taken from (bevington--- polfit.f)

i'm making some mistake, and i could not find what is the problem with this.
When i give some other other random data it is fitting properly
but not the data i have :(
for y = a + bx + cx^2 i should get the coefficients to be

a = 1.4558380406304288E+03
b = -3.6779173737460803E+02
c = 2.3247378080674739E+01

but I am getting as
a = -16.2156696
b = -1.78127503
c = 0.496948689


can somebody please please help me to find out the problem

here i have attached the prg

thank you,
regards,
akila
 

Attachments

Physics news on Phys.org
Firstly, you can enclose code directly into the forum by using the CODE tags.

OK, what compiler options have you used? I notice that you don't include an IMPLICIT NONE statement. wt is not defined as an array, how does the implicit declaration work for arrays?

If you got polfit from some sort of library, then your inputs are probably wrong. Also, go back to that library's documentation and make sure you know what all those variables are. For example, the variable MODE in the subroutine isn't crystal clear to me.