background image

Politechnika Wrocławska

Wydział Elektryczny

Wojciech Calów

Rok studiów : III
Semestr : VI
Rok akad. : 2012/13

 Laboratorium Metod Numerycznych

Data: 

Temat : 

Interpolacja funkcji dyskretnej

Ocena: 

1. Program

%% Interpolacje ============================================

k = 0:7;

y = [-2.2 -1.6 0.5 1.6 1.0 0.4 -0.6 -0.8];
T=0.001; 

% skok

m=0;
l=1;

P=1:(max(k)/T)+1;
t=0:T:7;

%% Interpolacja 3 punktowa =================================

for

 i = 1:length(y)-2

    d=m:T:2;
    

for

 h=1:length(d)

        P(l)=0.5*(2*y(i)-d(h)*(3*y(i)-4*y(i+1)+y(i+2))+
(d(h)^2)*(y(i)-2*y(i+1)+y(i+2)));

        l=l+1;
    

end

    m=1+T;

end

%% PLOT ====================================================

figure(2);

hold 

on

;

grid 

on

;

stem(k,y,

'ro'

);

plot(t,P,

'LineWidth'

,1.4);

title(

'Interpolacja funkcji dyskretnej'

)

xlabel(

'k (nr próbki)'

);

ylabel(

'Wartosc y'

);

2. Wynik interpolacji

background image