Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have 5 data points (experimental). I want to carry out cubic spline interpolation and extract (x,y) co-ordinates of '100' points between x=0 to 50. Can someone please help me with this problem.I am a beginner so i don't have much idea about it. I need a program in either matlab or python. Points are given below. someone please help me.

Points are (0,0.256) (12.5, 0.218) (25, 0.165) (37.5, 0.247) (50, 0.294).
Posted
Updated 15-Nov-15 21:06pm
v2
Comments
dan!sh 6-Oct-15 0:49am    
Do you know the polynomial that is used to generate the curve? You just need to solve the polynomial then to get N solutions.
Sergey Alexandrovich Kryukov 6-Oct-15 1:10am    
To say so, you would need to know which interpolation method should be used, exactly. (And what are "N solutions"? N points is one solution, not N... and so on...) But probably you have a correct basic idea. Please see Solution 1.
—SA
dan!sh 6-Oct-15 1:15am    
My point exactly. OP needs to know the polynomial. He must, since he will be generating the curve. So reading from screen representation of data is out of picture.
Sergey Alexandrovich Kryukov 6-Oct-15 1:22am    
Yes, of course, I just say that polynomial interpolation is not the only kind of interpolation. The key is not trying to read from screen.
—SA
Member 12035385 6-Oct-15 1:23am    
i am restricting to cubic spline

1 solution

This is wrong approach.

Right approach would be this:
Data ──> Interpolated Data ──> Graphical plot
          │
          └──> Data you need
Instead, you are trying to get data back from graphics. This is wrong. Graphics should be write-only.

—SA
 
Share this answer
 
Comments
Member 12035385 8-Oct-15 0:23am    
As i said there are 10 known points. i am fitting a cubic spline through these points. how can i get coordinates of other points from the interpolated curve?
Sergey Alexandrovich Kryukov 8-Oct-15 2:45am    
I already answered. The rest depends on your detail. You did not even specify the language, just listed three...
—SA
Member 12035385 13-Oct-15 23:01pm    
I am currently using matlab. Planning to use python in future if time permits. The solution u mentioned is perfect. That is what i need. To be frank i am new to this area. So i dont have much idea about interpolation. After reading few book i decided to try with cubic spline. My main concern is the point coordinates. IS there any way to get the point data as a matrix output. i am unable to do it. If needed i can provide details about 10 data points.
Sergey Alexandrovich Kryukov 13-Oct-15 23:14pm    
Sorry, I don't understand what you are missing. If you already use some interpolation algorithm, it gives you the points...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900