13.07.2015 Views

Analisi dell'errore dei Polinomi interpolanti e applicazioni in 3D

Analisi dell'errore dei Polinomi interpolanti e applicazioni in 3D

Analisi dell'errore dei Polinomi interpolanti e applicazioni in 3D

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CAPITOLO 3. INTERPOLAZIONE <strong>3D</strong> 29List<strong>in</strong>g 3.1: Funzione new_lag<strong>in</strong>t_<strong>3D</strong>%f u n c t i o n [ px , py , Lx , Ly ,P, Zf ]=new_lag<strong>in</strong>t_<strong>3D</strong> ( x , y , t_x , t_y , fx , f y )function [ P, Zf ]=new_lag<strong>in</strong>t_<strong>3D</strong> ( x , y , t_x , t_y , fx , f y )m = length ( x ) ;%numero d e i p u n t i s c e l t i per v a l u t a r e l a f u n z i o n en_x= length ( t_x ) −1;%numero d e i p u n t i d i i n t e r p o l a z i o n en_y= length ( t_y ) −1;%Si richiama l a f u n z i o n e new_lag<strong>in</strong>t per l a c o s t r u z i o n e d e i pol<strong>in</strong>omi%i n t e r p o l a n t i px , py e l e f u n z i o n i d i Lagrange Lx , Ly[ px , Lx]= new_lag<strong>in</strong>t ( x , t_x , f x ) ;[ py , Ly]= new_lag<strong>in</strong>t ( y , t_y , f y ) ;[ Xt , Yt]=meshgrid(t_x , t_y ) ;%Zt=z e r o s (n_y+1,n_x+1) ;Zf=(s<strong>in</strong> (2∗ pi ∗Xt ) . ∗ s<strong>in</strong> (2∗ pi ∗Yt ) ) ' ;P=zeros (m) ; %matrice quadrata contenente i l pol<strong>in</strong>omio i n t e r p o l a n t efor k=1:m %k i n d i c e r i g a matrice Pfor l =1:m %l i n d i c e colonnafor i =1:n_x+1 %i n d i c e r i g a matrice Zf contenente l af u n z i o n e Z%c a l c o l a t a nei p u n t i d i i n t e r p o l a z i o n efor j =1:n_y+1 % i n d i c e colonnaP( k , l )=P( k , l )+(Zf ( i , j ) ∗(Lx ( k , i ) ∗Ly ( l , j ) ) ) ;endendendendFigura 3.1: Funzione da <strong>in</strong>terpolare

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!