Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Problem with cubic spline interplation

Problem with cubic spline interplation

Problem with cubic spline interplation

I'm trying to reconstruct a curve with the cubic spline interpolation. I wrote a code that asks me where I want to interpolate, and when I put the value of x, it gives me the value of f(x).
Here there is a piece of my code and I would like to know how to reconstruct the whole curve.

print*,'Where do you want to interpolate?'
read(*,*) int

DO i=2,num
IF (int>=x(i-1) .and. int<=x(i)) then
print*,'x is between ',x(i-1),' and ',x(i)
t2=(y(i-1)/den -(d2(i-1)*den)/6.)*(x(i)-int)
t3=(y(i)/den -(d2(i)*den)/6.)*(int-x(i-1))


I added this to generate all the x that are missing from the data, in order to obtain all the f(x) values and so reconstruct the curve:

do i=1,nint
end do

I can't put them together, can anyone help me?
If it is not clear, I can try to explain it better.
thanks in advance

RE: Problem with cubic spline interplation

In line 142 if the attached spline.f90 file you have "xn(i)=int", except that "int" has never been initialized nor assigned any value, not before entering the loop, not in the loop, not anywhere.

By the way, for your variable names, try to use something other that Fortran keywords for statements or functions.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close