This commit is contained in:
LinlyBoi
2023-05-07 15:19:34 +03:00
parent 1060ad7f8a
commit b5b05e13ce
3 changed files with 71 additions and 0 deletions

12
curvefittingig.m Normal file
View File

@@ -0,0 +1,12 @@
clear, clc
xf = [0:0.05:10];
yf = sin (2*pi*xf/5);
xp = [0:10];
yp = sin (2*pi*xp/5);
lin = interp1 (xp, yp, xf);
near = interp1 (xp, yp, xf, "nearest");
pch = interp1 (xp, yp, xf, "pchip");
spl = interp1 (xp, yp, xf, "spline");
plot (xf,yf,"r", xf,near,"g", xf,lin,"b", xf,pch,"c", xf,spl,"m",
xp,yp,"r*");
legend ("original", "nearest", "linear", "pchip", "spline");