کد متلب (MATLAB) : مثال شماره 5
کدهای متلب :
clear all
close all
clc
x = [-12:4:12];
y = atan(x) ;
t = [-12:0.1:12];
p = pchip (x,y,t);
s = spline (x,y,t) ;
plot(x,y, 'o' ,t,p, '-' ,t,s, '-.' , 'LineWidth' ,1.25)
xlim([-12 12])
legend ('data1' , 'pchip' , 'spline' , 'Location' , 'NW')
close all
clc
x = [-12:4:12];
y = atan(x) ;
t = [-12:0.1:12];
p = pchip (x,y,t);
s = spline (x,y,t) ;
plot(x,y, 'o' ,t,p, '-' ,t,s, '-.' , 'LineWidth' ,1.25)
xlim([-12 12])
legend ('data1' , 'pchip' , 'spline' , 'Location' , 'NW')
نتیجه :

منبع کدها :
کتاب MATLAB Guide - D.J. Higham - second edition - صفحه 162 از فایل pdf کتاب
دسته بندی انواع رسم شکل در متلب
نظرات 0 0 0