Добавил:
sabzeee
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:lab 4 / test_gridinterp
.m function test_gridinterp(x,y)
p=x(1):0.1:x(end);
f=griddedInterpolant(x,y,'linear');
f1=f(p);
f=griddedInterpolant(x,y,'nearest');
f2=f(p);
f=griddedInterpolant(x,y,'next');
f3=f(p);
f=griddedInterpolant(x,y,'previous');
f4=f(p);
f=griddedInterpolant(x,y,'pchip');
f5=f(p);
f=griddedInterpolant(x,y,'makima');
f6=f(p);
f=griddedInterpolant(x,y,'spline');
f7=f(p);
figure;
hold on
plot(x,y,'ro','Markersize',10)
plot(p,f1,p,f2,p,f3,p,f4,p,f5,p,f6,p,f7)
grid on
title('Interpolation Of the Table data y(x)');
xlabel('x');
ylabel('interp.function and table data');
legend({'y', 'linear', 'nearest','next','previous','pchip','makima','spline'},'location','best');
end
p=x(1):0.1:x(end);
f=griddedInterpolant(x,y,'linear');
f1=f(p);
f=griddedInterpolant(x,y,'nearest');
f2=f(p);
f=griddedInterpolant(x,y,'next');
f3=f(p);
f=griddedInterpolant(x,y,'previous');
f4=f(p);
f=griddedInterpolant(x,y,'pchip');
f5=f(p);
f=griddedInterpolant(x,y,'makima');
f6=f(p);
f=griddedInterpolant(x,y,'spline');
f7=f(p);
figure;
hold on
plot(x,y,'ro','Markersize',10)
plot(p,f1,p,f2,p,f3,p,f4,p,f5,p,f6,p,f7)
grid on
title('Interpolation Of the Table data y(x)');
xlabel('x');
ylabel('interp.function and table data');
legend({'y', 'linear', 'nearest','next','previous','pchip','makima','spline'},'location','best');
end
Соседние файлы в папке lab 4