Shape-preserving rational spline Hermite interpolation
Versión 1.0.0 (2,02 KB) por
Sunham Kim
MATLAB codes for Cai and Judd (2012)'s Shape-preserving rational spline Hermite interpolation
rationalspline.m
A quick MATLAB snippet to implement shape-preserving rational spline Hermite interpolation.(Cai and Judd, Economic Letters 2012)
Requires MATLAB 2015a or later. (dependency: discretize
)
Example
x = linspace(0.1,3,30).'; z = linspace(0.1,3,300).';
v = log(x);
s = 1./x;
[f,df,d2f] = rationalspline(x,z,v,s);
truf = log(z);
trudf = 1./z;
figure;
tt = tiledlayout(1,2);
nexttile
hold on;
plot(z,f);
plot(z,truf);
legend('Approximated Level','True Level','Location','best');
hold off;
nexttile
hold on;
plot(z,df);
plot(z,trudf);
legend('Approximated Slope','True Slope','Location','best');
hold off;
![Screenshot 2023-08-19 at 7 24 01 AM](https://private-user-images.githubusercontent.com/50336173/261795089-cef69bec-295f-41b6-a939-4d827ccf426f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDQzMDI1OTEsIm5iZiI6MTcwNDMwMjI5MSwicGF0aCI6Ii81MDMzNjE3My8yNjE3OTUwODktY2VmNjliZWMtMjk1Zi00MWI2LWE5MzktNGQ4MjdjY2Y0MjZmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAxMDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMTAzVDE3MTgxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU2MWFjNmU5ZGEzY2QzMjQ0N2Y3N2QyY2FhNDE2Nzg5YmRhNmU0NWNkZWNkODk2YTA4YjQ0ZDg1NjE4NDI5NmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.i8QgSNKHknDBmudzkHsu4k7nTg5XPIpq31IgRoRAxA8)
Citar como
Sunham Kim (2024). Shape-preserving rational spline Hermite interpolation (https://github.com/sunhamkim/rationalspline/releases/tag/v1.0.0), GitHub. Recuperado .
Compatibilidad con la versión de MATLAB
Se creó con
R2023a
Compatible con cualquier versión desde R2015a
Compatibilidad con las plataformas
Windows macOS LinuxEtiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.0.0 |
Para consultar o notificar algún problema sobre este complemento de GitHub, visite el repositorio de GitHub.
Para consultar o notificar algún problema sobre este complemento de GitHub, visite el repositorio de GitHub.