Natural Cubic Spline Interpolation

Natural Cubic Spline Interpolation
Choose x0, x1, x2, x3 and y0, y1, y2, y3. Write an .m file to compute the third order polynomials for the intervals [x0, x1], [x1, x2], [x2, x3]. Plot the functions and the points xi, yi on the same figure. Figure should clearly show that the polynomials pass through the points.
I will choose my own xi, yi and test your code

9 comentarios

KSSV
KSSV el 8 de Jun. de 2020
Editada: KSSV el 8 de Jun. de 2020
Good ...go ahead. But why to announce? :D
Omer Saglam
Omer Saglam el 8 de Jun. de 2020
because i don't know how to solve it. i need help
KSSV
KSSV el 8 de Jun. de 2020
Read about spline. It has got good dcumentation with examples.
John D'Errico
John D'Errico el 8 de Jun. de 2020
You can do some reading of your own. Answers is not a site where we will do your homework. As difficult as this may seem, you need to learn enough of MATLAB to solve this, and you need to learn about cubic splines. The key is in your hands, making the effort to learn.
Omer Saglam
Omer Saglam el 8 de Jun. de 2020
WHAT DO YOU THINK ABOUT THIS SOLUTION?
Rik
Rik el 8 de Jun. de 2020
Why did you write it on a piece of paper? Now it is difficult to suggest edits.
Rik
Rik el 10 de Jun. de 2020
Question body retrieved from the activity feed:
Natural Cubic Spline Interpolation Choose x0, x1, x2, x3 and y0, y1, y2, y3.
Write an .m file to compute the third order polynomials for the intervals [x0, x1], [x1, x2], [x2, x3]. Plot the functions and the points xi, yi on the same figure. Figure should clearly show that the polynomials pass through the points.
I will choose my own xi, yi and test your code
John D'Errico
John D'Errico el 10 de Jun. de 2020
What do I think of that solution? It reminds me vaguely of a comic that I recall hanging on every office wall, in every breakroom where I worked and went to school.
It showed two scientists discussing some scribbles on a blackboard. A theorem perhaps. But in the middle of those scribbles with the derivation is a cloud that contains the words "and then a miracle occurs".
Effectively, your solution of a cubic spline also requires a miracle. The flow chart before and after that seems not unreasonable. Some things probably need to be filled out. But it is that miraculous cloudy part that will be the hang up.
Rena Berman
Rena Berman el 12 de Oct. de 2020
(Answers Dev) Restored edit

Iniciar sesión para comentar.

Respuestas (1)

Ameer Hamza
Ameer Hamza el 8 de Jun. de 2020
Editada: Ameer Hamza el 8 de Jun. de 2020

0 votos

See interp1(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/interp1.html with 'pchip', or 'spline' methods.
For natural cubic spline, see this answer: https://www.mathworks.com/matlabcentral/answers/387177-plot-natural-cubic-spline#answer_309106, using csape function.

Categorías

Más información sobre Interpolation en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 8 de Jun. de 2020

Comentada:

el 12 de Oct. de 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by