Piecewise polynomial integration (ppint)

2 visualizaciones (últimos 30 días)
Jamal Nasir
Jamal Nasir el 12 de Abr. de 2018
Comentada: John D'Errico el 12 de Abr. de 2018
Is the command piecewise polynomial integration (ppint) not working anymore? Below is an example given by an old member of the community https://de.mathworks.com/matlabcentral/fileexchange/13812-splinefit?focused=7896654&tab=function:
x = linspace(-pi,pi,7);
y = sin(x);
plot(x,y)
hold on
pp = interp1(x,y,x,'spline');
plot(x,pp+0.1)
I = ppint(pp,1)
'Undefined function or variable' error comes up. If it is not available anymore, what is the alternative for such a case?

Respuestas (2)

John D'Errico
John D'Errico el 12 de Abr. de 2018
Editada: John D'Errico el 12 de Abr. de 2018
Just use fnint.
x = linspace(0,2*pi,20);
y = sin(x);
pp = spline(x,y);
ppcos = fnint(pp);
fnplt(ppcos)
As you can see, we get effectively -cos(x). Of course, the constant of integration is missing.
  2 comentarios
Jamal Nasir
Jamal Nasir el 12 de Abr. de 2018
Thank you for your answer. Unfortunately, our matlab license doesn't include that functionality. We need to change that. Could you please, anyways, also tell me the double integration function? I actually need to fit ESR/EPR data and then double integrate to quantify the electron spins.
John D'Errico
John D'Errico el 12 de Abr. de 2018
I think fnint comes with the curvefitting toolbox. The curve fitting toolbox is well worth obtaining.
If you had fnint, then the double integral would be just
fnint(pp,2)
I could write a ppint code, but it looks like Walter has already offered a source.

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 12 de Abr. de 2018

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by