not-a-knot spline

10 visualizaciones (últimos 30 días)
Gianluca Manissero
Gianluca Manissero el 20 de Jun. de 2018
Comentada: Kaloyan Pavlov el 8 de Dic. de 2020
i need to calculate the value of the cubic spline not a knot in the point x=1.97, the problem gives me coordinates of x=[0.0 0.5 1.0 1.5 2.0] and the function y=(sin(x)-(x+1).^2)/(x.^2+3). i don't understand why sometimes when i do y=f(x) it gives me a vector and sometimes like now it gives me only a value, and as a result it gives me an error when calculating the spline.

Respuesta aceptada

KSSV
KSSV el 20 de Jun. de 2018
x=[0.0 0.5 1.0 1.5 2.0] ;
y = @(x) (sin(x)-(x+1).^2)./(x.^2+3) ;
y = y(x) ;
xi = 1.97 ;
yi = interp1(x,y,xi,'spline')
plot(x,y,'b')
hold on
plot(xi,yi,'*r')
  2 comentarios
Gianluca Manissero
Gianluca Manissero el 20 de Jun. de 2018
thanks a lot, i didn't put the point before the "/" that's why i wasn't able of solving the exercise.
Kaloyan Pavlov
Kaloyan Pavlov el 8 de Dic. de 2020
Sorry I dont understand, if you have the function why not just calculate the function with x = 1.97?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by