boggiatto.mws

 

LA   TRASFORMATA   DI   FOURIER
 

 

UNA   PRESENTAZIONE   PURAMENTE   GRAFICO- QUALITATIVA 

DEI   SUOI   SIGNIFICATI   IN   TEORIA   DEI   SEGNALI 

 

Paolo Boggiatto, Giuseppe De Donno, Alessandro Oliaro 

 

Plot_2d
 

 

Plot 

 

>
 

> ----------------------------------------------------------------------------------------------------------------
 

>
 

SEGNALI   E   FREQUENZE 

 

 

 

Segnale   =   funzione   f : R --> R 

Consideriamo qui esclusivamente segnali, ovvero funzioni, da R in R. Assumeremo inoltre che la variabile indipendente  t  rappresenti il tempo, mentre la variabile dipendente  y = f ( t )  rappresenti una certa grandezza fisica (ad esempio in segnali acustici si può pensare che  y  indichi la pressione atmosferica). 

 

 

Frequenza di un segnale: 

a rigore si dice che ad un segnale  y = f ( t )  corrisponde una frequenza "pura"   w   se e solo se il segnale è una funzione del tipo: 

f(x) = `+`(`*`(A, `*`(cos(`+`(`*`(2, `*`(Pi, `*`(w, `*`(`+`(t, `-`(b)))))))))), K) (1)
 

 

con  w,  A,  b,  K costanti reali fissate.  Ad esempio: 

> w:=1; A:=2; b:=0; K:=4;
 

`:=`(w, 1) (2)
 

`:=`(A, 2) (2)
 

`:=`(b, 0) (2)
 

`:=`(K, 4) (2)
 

Il segnale f(t) è assegnato a MAPLE con l'istruzione: 

> f:=x->A*cos(2*Pi*w*(x-b))+K;
 

`:=`(f, proc (x) options operator, arrow; `+`(`*`(A, `*`(cos(`+`(`*`(2, `*`(Pi, `*`(w, `*`(`+`(x, `-`(b)))))))))), K) end proc) (3)
 

Ed il suo grafico si ottiene con: 

> plot(f, -20..20, -5..10, numpoints=500, tickmarks=[20,10], thickness=2);
 

Plot_2d
 

Significato delle costanti introdotte. 

 

w = frequenza = numero di oscillazioni complete nell'unita' di tempo, 

A = ampiezza delle oscilazioni,  

b = traslazione orizzontale, 

K = traslazione verticale. 

 

 

ESERCIZIO:  verificare graficamente il significato del parametri precedenti cambiandone i valori e facendo eseguire i corrispondenti grafici. 

 

 

 

 

Esempi di segnali a cui è naturale assicuare la frequenza 1
 

Nota: solo nel primo caso ha senso la definizione di frequenza come inverso del periodo e tuttavia si tratta di un segnale non realizzabile fisicamente!!! 

> g1:=t->cos(2*Pi*t);
 

`:=`(g1, proc (t) options operator, arrow; cos(`+`(`*`(2, `*`(Pi, `*`(t))))) end proc) (4)
 

> plot(g1,-20..20, numpoints=500, thickness=2);
 

Plot_2d
 

> g2:=t->exp(-0.02*t^2)*cos(2*Pi*t);
 

`:=`(g2, proc (t) options operator, arrow; `*`(exp(`+`(`-`(`*`(0.2e-1, `*`(`^`(t, 2)))))), `*`(cos(`+`(`*`(2, `*`(Pi, `*`(t))))))) end proc) (5)
 

> plot(g2,-20..20, numpoints=500, thickness=2);
 

Plot_2d
 

> g3:=t->exp(0.1*t)*cos(2*Pi*t);
 

`:=`(g3, proc (t) options operator, arrow; `*`(exp(`+`(`*`(.1, `*`(t)))), `*`(cos(`+`(`*`(2, `*`(Pi, `*`(t))))))) end proc) (6)
 

> plot(g3,-20..20, numpoints=500, thickness=2);
 

Plot_2d
 

> g4:=t->cos(2*Pi*0.05*t)*cos(2*Pi*t);
 

`:=`(g4, proc (t) options operator, arrow; `*`(cos(`+`(`*`(.10, `*`(Pi, `*`(t))))), `*`(cos(`+`(`*`(2, `*`(Pi, `*`(t))))))) end proc) (7)
 

> plot(g4,-20..20, numpoints=500, thickness=2);
 

Plot_2d
 

> g5:=t->piecewise(t<-15,cos(2*Pi*t),t<-10,0,t<-5,cos(2*Pi*t),t<0,0,t<5,cos(2*Pi*t),t<10,0,t<15,cos(2*Pi*t),0);
 

`:=`(g5, proc (t) options operator, arrow; piecewise(`<`(t, -15), cos(`+`(`*`(2, `*`(Pi, `*`(t))))), `<`(t, -10), 0, `<`(t, -5), cos(`+`(`*`(2, `*`(Pi, `*`(t))))), `<`(t, 0), 0, `<`(t, 5), cos(`+`(`*`...
`:=`(g5, proc (t) options operator, arrow; piecewise(`<`(t, -15), cos(`+`(`*`(2, `*`(Pi, `*`(t))))), `<`(t, -10), 0, `<`(t, -5), cos(`+`(`*`(2, `*`(Pi, `*`(t))))), `<`(t, 0), 0, `<`(t, 5), cos(`+`(`*`...
(8)
 

> plot(g5,-20..20, numpoints=500, thickness=2);
 

Plot_2d
 

> g5:=t->piecewise(t<-10,(t+20)*cos(2*Pi*t),t<0,(t+10)*cos(2*Pi*t),t<10,t*cos(2*Pi*t),t<20,(t-10)*cos(2*Pi*t));
 

`:=`(g5, proc (t) options operator, arrow; piecewise(`<`(t, -10), `*`(`+`(t, 20), `*`(cos(`+`(`*`(2, `*`(Pi, `*`(t))))))), `<`(t, 0), `*`(`+`(t, 10), `*`(cos(`+`(`*`(2, `*`(Pi, `*`(t))))))), `<`(t, 10...
`:=`(g5, proc (t) options operator, arrow; piecewise(`<`(t, -10), `*`(`+`(t, 20), `*`(cos(`+`(`*`(2, `*`(Pi, `*`(t))))))), `<`(t, 0), `*`(`+`(t, 10), `*`(cos(`+`(`*`(2, `*`(Pi, `*`(t))))))), `<`(t, 10...
(9)
 

> plot(g5,-20..20, numpoints=500, thickness=2);
 

Plot_2d
 

>
 

>
 

>
 

>
 

>
 

>
 

>
 

>
 

>
 

> ----------------------------------------------------------------------------------------------------------------
 

>
 

TRASFORMATA  DI  FOURIER 

 

La Trasformata di Fourier di un segnale f(t) è la nuova funzione F(w) della variabile reale w definita da:  

 

> F:=w-> int(exp(-2*Pi*I*x*w)*f(x),x=-infinity..infinity);
 

`:=`(F, proc (w) options operator, arrow; int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(w))))))), `*`(f(x))), x = `+`(`-`(infinity)) .. infinity) end proc) (10)
 

Nota: in genere anche se  f (t ) è reale la sua trasformata assumerà valori complessi. 

 

Nota: Chiaramente la trasformata di Fourier ora definita ha senso solo per le funzioni per cui esiste l'integrale che  

ompare nella formula precedente. In Analisi di Fourier esistono parecchie estensioni della trasfomata di Fourier a  

casi in cui l'integrale precedente non esiste in senso classico. 

 

__________________________________________________________________________________________________________________ 

NOTA:    

Per chi volesse avere una definizione un po' più precisa sono necessarie le seguenti precisazioni: 

__________________________________________________________________________________________________________________________________ 

0) Numeri complessi. Sono oggetti del tipo   a + I b   dove "a, b" sono numeri reali ed   "I"   è l'"unità immaginaria" con la prorpietà  

che I^2=-1. Sui numeri complessi sono poi definite opportune operazioni algebriche.    

Provare a far calcolare da Maple I^2: 

> I^2;
 

-1 (11)
 

__________________________________________________________________________________________________________________________________ 

1) Esponenziale complesso.  Vale la formula di Eulero:   

> exp(It)=cos(t)+I*sin(t);
 

exp(It) = `+`(cos(t), `*`(sin(t), `*`(I))) (12)
 

 

da questa segue che, se  f( x) è una funzione a valori reali: 

> exp(-2*Pi*I*x)*f(x)=f(x)*cos(2*Pi*x)+I*f(x)*sin(2*Pi*x);
 

`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x)))))), `*`(f(x))) = `+`(`*`(f(x), `*`(cos(`+`(`*`(2, `*`(Pi, `*`(x))))))), `*`(f(x), `*`(sin(`+`(`*`(2, `*`(Pi, `*`(x))))), `*`(I)))) (13)
 

___________________________________________________________________________________________________________________ 

>
 

>
 

> __________________________________________________________________________________________________________________
 

2) Integrale di funzioni complesse: 

L'integrale   della funzione complessa    Typesetting:-mrow(Typesetting:-mi( 

tra due valori reali a,b è definito da 

> int(exp(-2*Pi*I*x)*f(x), x=a..b)=int(cos(2*Pi*x)*f(x), x=a..b)+I*(int(sin(2*Pi*x)*f(x), x=a..b));
 

int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x)))))), `*`(f(x))), x = a .. b) = `+`(int(`*`(f(x), `*`(cos(`+`(`*`(2, `*`(Pi, `*`(x))))))), x = a .. b), `*`(int(`*`(f(x), `*`(sin(`+`(`*`(2,... (14)
 

______________________________________________________________________________________________________________________________________ 

3) Integrali generalizzati (di Riemann): 

l'integrale di Riemann della funzione  Typesetting:-mrow(Typesetting:-mi(  esteso all'intevallo   (-infinto ... +infinito)   viene definito tramite i limiti seguenti: 

> int(exp(2*Pi*I*x)*f(x), x=-infinity..infinity)=Limit(int(exp(-2*Pi*I*x)*f(x), x=A..0), A=-infinity)+Limit(int(exp(-2*Pi*I*x)*f(x), x=0..B), B=+infinity);
 

int(`*`(exp(`*`(`*`(2, `*`(I)), `*`(Pi, `*`(x)))), `*`(f(x))), x = `+`(`-`(infinity)) .. infinity) = `+`(Limit(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x)))))), `*`(f(x))), x = A .. 0)... (15)
 

_______________________________________________________________________________________________________________________ 

>
 

>
 

>
 

>
 

>
 

>
 

>
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

__________________________________________________________________________________________________________________________________ 

Trasformata di Fourier di una frequenza pura: il caso "esemplificativo" del motivo per cui la trasformata di Fourier indica le frequenze di un segnale. 

 

 

 

Assegnamo i valori: 

> w:=2; A:=4; b:=0; K:=3;
 

`:=`(w, 2) (16)
 

`:=`(A, 4) (16)
 

`:=`(b, 0) (16)
 

`:=`(K, 3) (16)
 

Consideriamo il seguente segnale  f(t)  corrispondente alla frequenza pura  "w": 

> f:=x->A*cos(2*Pi*w*(x-b))+K;
 

`:=`(f, proc (x) options operator, arrow; `+`(`*`(A, `*`(cos(`+`(`*`(2, `*`(Pi, `*`(w, `*`(`+`(x, `-`(b)))))))))), K) end proc) (17)
 

il grafico di  f (t)  è: 

> plot(f, -8..8, -4..9, numpoints=500, tickmarks=[20,10], thickness=2);
 

Plot_2d
 

La trasformata di una frequenza pura non è una funzione ma una distributione, in particolare una delta di Dirac centrata nel punto corrispondente alla frequenza.  

Possiamo rappresentarla nel modo seguente: 

 

> PLOT(CURVES([[w, 0], [w, 10], [w-.3,9], [w, 10], [w+.3,9]]), COLOR(RGB,1,0,0), POINTS([w,0], [0,0], [20, 0]), AXESTICKS(10,5),THICKNESS(2));
 

Plot_2d
 

Se si prova tuttavia a far disegnare il grafico della trasformata di Fourier di una frequenza pura, essendo una distribuzione, MAPLE da errore !!! 

 

> Fg:=t->abs(int(exp(-2*Pi*I*x*t)*f(x),x=-infinity..infinity));
 

`:=`(Fg, proc (t) options operator, arrow; abs(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(f(x))), x = `+`(`-`(infinity)) .. infinity)) end proc) (18)
 

> plot({Fg}, 0..20);
 

Plotting error, empty plot
 

__________________________________________________________________________________________________________________________________ 

Trasformata di Fourier di gaussiana modulata: come la trasformata di Fourier indica le frequenze di un segnale reale. 

 

> g:=t->exp(-A*t^2)*cos(2*Pi*w*t);
 

`:=`(g, proc (t) options operator, arrow; `*`(exp(`+`(`-`(`*`(A, `*`(`^`(t, 2)))))), `*`(cos(`+`(`*`(2, `*`(Pi, `*`(w, `*`(t)))))))) end proc) (19)
 

> A:=10;
 

`:=`(A, 10) (20)
 

> w:=12;
 

`:=`(w, 12) (21)
 

 

> plot(g,-5..5, numpoints=500, thickness=2);
 

Plot_2d
 

> Fg:=t->abs(int(exp(-2*Pi*I*x*t)*g(x),x=-infinity..infinity));
 

`:=`(Fg, proc (t) options operator, arrow; abs(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(g(x))), x = `+`(`-`(infinity)) .. infinity)) end proc) (22)
 

> plot({Fg}, 0..20, thickness=2);
 

Plot_2d
 

 

 

 

 

 

 

 

 

 

 

 

 

 

____________________________________________________________________________________________________________________________________ 

Trasformata di segnale "ad intermittenza" 

 

> g5:=t->piecewise(t<-20,0,t<-15,cos(2*Pi*t),t<-10,0,t<-5,cos(2*Pi*t),t<0,0,t<5,cos(2*Pi*t),t<10,0,t<15,cos(2*Pi*t),0);
 

`:=`(g5, proc (t) options operator, arrow; piecewise(`<`(t, -20), 0, `<`(t, -15), cos(`+`(`*`(2, `*`(Pi, `*`(t))))), `<`(t, -10), 0, `<`(t, -5), cos(`+`(`*`(2, `*`(Pi, `*`(t))))), `<`(t, 0), 0, `<`(t,...
`:=`(g5, proc (t) options operator, arrow; piecewise(`<`(t, -20), 0, `<`(t, -15), cos(`+`(`*`(2, `*`(Pi, `*`(t))))), `<`(t, -10), 0, `<`(t, -5), cos(`+`(`*`(2, `*`(Pi, `*`(t))))), `<`(t, 0), 0, `<`(t,...
(23)
 

> plot(g5,-25..25, numpoints=500, thickness=2);
 

Plot_2d
 

> Fg:=t->abs(int(exp(-2*Pi*I*x*t)*g5(x),x=-20..20));
 

`:=`(Fg, proc (t) options operator, arrow; abs(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(g5(x))), x = -20 .. 20)) end proc) (24)
 

> plot(Fg, 0..20, thickness=2);
 

Plot_2d
 

>
 

La trasformata di Fourier segnala le frequenze presenti in un segnale
 

>
 

> g:=t->piecewise(t<-5,0,t<5,A*cos(2*w*Pi*t),0);
 

`:=`(g, proc (t) options operator, arrow; piecewise(`<`(t, -5), 0, `<`(t, 5), `*`(A, `*`(cos(`+`(`*`(2, `*`(w, `*`(Pi, `*`(t)))))))), 0) end proc) (25)
 

 

> A:=4;
 

`:=`(A, 4) (26)
 

 

> w:=2;
 

`:=`(w, 2) (27)
 

 

> plot(g,-10..10, numpoints=300, thickness=2);
 

Plot_2d
 

> Fg:=t->int(exp(-2*Pi*I*x*t)*g(x),x=-infinity..infinity);
 

`:=`(Fg, proc (t) options operator, arrow; int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(g(x))), x = `+`(`-`(infinity)) .. infinity) end proc) (28)
 

> plot({Fg}, 0..10, numpoints=300, thickness=2);
 

Plot_2d
 

>
 

>
 

La trasformata di Fourier di Gaussiane modulate
 

 

____________________________________________________________________________________________________________________________________________________ 

1) Modulazione con coseni 

> g1:=t->exp(-A1*t^2)*cos(2*Pi*w1*t);
 

`:=`(g1, proc (t) options operator, arrow; `*`(exp(`+`(`-`(`*`(A1, `*`(`^`(t, 2)))))), `*`(cos(`+`(`*`(2, `*`(Pi, `*`(w1, `*`(t)))))))) end proc) (29)
 

> g2:=t->exp(-A2*t^2)*cos(2*Pi*w2*t);
 

`:=`(g2, proc (t) options operator, arrow; `*`(exp(`+`(`-`(`*`(A2, `*`(`^`(t, 2)))))), `*`(cos(`+`(`*`(2, `*`(Pi, `*`(w2, `*`(t)))))))) end proc) (30)
 

> A1:=4; A2:=3;
 

`:=`(A1, 4) (31)
 

`:=`(A2, 3) (31)
 

> w1:=10; w2:=7;
 

`:=`(w1, 10) (32)
 

`:=`(w2, 7) (32)
 

> plot(g1,-5..5, numpoints=500, thickness=2);
 

Plot_2d
 

> plot(g2,-5..5, numpoints=500, thickness=2);
 

Plot_2d
 

Nota: la trasformata di Fourier è in genere una funzione complessa e quindi il grafico non può essere disegnato in un piano. 

Tuttavi si dimostra che le trasformate di funzioni del tipo g1 e g2 sono reali e quindi nel nostro caso il problema non sussiste. 

> Fg1:=t->int(exp(-2*Pi*I*x*t)*g1(x),x=-infinity..infinity);
 

`:=`(Fg1, proc (t) options operator, arrow; int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(g1(x))), x = `+`(`-`(infinity)) .. infinity) end proc) (33)
 

> Fg2:=t->int(exp(-2*Pi*I*x*t)*g2(x),x=-infinity..infinity);
 

`:=`(Fg2, proc (t) options operator, arrow; int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(g2(x))), x = `+`(`-`(infinity)) .. infinity) end proc) (34)
 

> plot({Fg1,Fg2}, -15..15, thickness=2);
 

Plot_2d
 

NOTA: Le frequenze "negative" fisicamente non hanno senso e sono una copia di quelle positive.  

 

 

 

 

 

 

 

 

 

 

 

______________________________________________________________________________________________________________________________ 

2)  Modulazione con esponenziali complessi: 

 

 

> f1:=t->exp(-A1*t^2)*exp(2*Pi*I*w1*t);
 

`:=`(f1, proc (t) options operator, arrow; `*`(exp(`+`(`-`(`*`(A1, `*`(`^`(t, 2)))))), `*`(exp(`*`(`*`(2, `*`(I)), `*`(Pi, `*`(w1, `*`(t))))))) end proc) (35)
 

> f2:=t->exp(-A2*t^2)*exp(2*Pi*I*w2*t);
 

`:=`(f2, proc (t) options operator, arrow; `*`(exp(`+`(`-`(`*`(A2, `*`(`^`(t, 2)))))), `*`(exp(`*`(`*`(2, `*`(I)), `*`(Pi, `*`(w2, `*`(t))))))) end proc) (36)
 

> A1:=4; A2:=3;
 

`:=`(A1, 4) (37)
 

`:=`(A2, 3) (37)
 

> w1:=10; w2:=7;
 

`:=`(w1, 10) (38)
 

`:=`(w2, 7) (38)
 

> Rf1:=t->Re(f1(t));
 

`:=`(Rf1, proc (t) options operator, arrow; Re(f1(t)) end proc) (39)
 

> Rf2:=t->Re(f2(t));
 

`:=`(Rf2, proc (t) options operator, arrow; Re(f2(t)) end proc) (40)
 

> plot(Rf1,-5..5, numpoints=500, thickness=2);
 

Plot_2d
 

> plot(Rf2,-5..5, numpoints=500, thickness=2);
 

Plot_2d
 

Nota: la trasformata di Fourier è in genere una funzione complessa e quindi il grafico non può essere disegnato in un piano. 

Tuttavi si dimostra che le trasformate di funzioni del tipo g1 e g2 sono reali e quindi nel nostro caso il problema non sussiste. 

> Ff1:=t->int(exp(-2*Pi*I*x*t)*f1(x),x=-infinity..infinity);
 

`:=`(Fg1, proc (t) options operator, arrow; int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(f1(x))), x = `+`(`-`(infinity)) .. infinity) end proc) (41)
 

> Ff2:=t->int(exp(-2*Pi*I*x*t)*f2(x),x=-infinity..infinity);
 

`:=`(Fg2, proc (t) options operator, arrow; int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(f2(x))), x = `+`(`-`(infinity)) .. infinity) end proc) (42)
 

> plot({Ff1,Ff2}, -15..15, thickness=2);
 

Plot_2d
 

>
 

>
 

>
 

Trasformata di Fourier di un segnale contenente 2 frequenze
 

> g1:=t->exp(-A1*t^2)*exp(2*Pi*w1*I*t);
 

`:=`(g1, proc (t) options operator, arrow; `*`(exp(`+`(`-`(`*`(A1, `*`(`^`(t, 2)))))), `*`(exp(`*`(`*`(2, `*`(I)), `*`(Pi, `*`(w1, `*`(t))))))) end proc) (43)
 

> g2:=t->exp(-A2*t^2)*exp(2*Pi*I*w2*t);
 

`:=`(g2, proc (t) options operator, arrow; `*`(exp(`+`(`-`(`*`(A2, `*`(`^`(t, 2)))))), `*`(exp(`*`(`*`(2, `*`(I)), `*`(Pi, `*`(w2, `*`(t))))))) end proc) (44)
 

> w1:=3; w2:=8;
 

`:=`(w1, 3) (45)
 

`:=`(w2, 8) (45)
 

> A1:=3; A2:=4;
 

`:=`(A1, 3) (46)
 

`:=`(A2, 4) (46)
 

> g:=t->g1(t)+g2(t);
 

`:=`(g, proc (t) options operator, arrow; `+`(g1(t), g2(t)) end proc) (47)
 

> Ag:=t->Re(g(t));
 

`:=`(Ag, proc (t) options operator, arrow; Re(g(t)) end proc) (48)
 

> plot(Ag,-5..5,numpoints=500, thickness=2);
 

Plot_2d
 

> Fg:=t->abs(int(exp(-2*Pi*I*x*t)*g(x),x=-infinity..infinity));
 

`:=`(Fg, proc (t) options operator, arrow; abs(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(g(x))), x = `+`(`-`(infinity)) .. infinity)) end proc) (49)
 

 

> plot({Fg}, 0..20, tickmarks=[20,10], thickness=2);
 

Plot_2d
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

_____________________________________________________________________________________________________________________________ 

Trasformata di Fourier di un segnale contenente più frequenze
 

 

 

> g:=t->sum(exp(-A[i]*t^2)*exp(2*Pi*I*w[i]*t), i=1..6);
 

`:=`(g, proc (t) options operator, arrow; sum(`*`(exp(`+`(`-`(`*`(A[i], `*`(`^`(t, 2)))))), `*`(exp(`*`(`*`(2, `*`(I)), `*`(Pi, `*`(w[i], `*`(t))))))), i = 1 .. 6) end proc) (50)
 

> A[1]:=0.5; A[2]:=0.2; A[3]:=1; A[4]:=2; A[5]:=0.3; A[6]:=0.8; A[7]:=0.5; A[8]:=2;
 

`:=`(A[1], .5) (51)
 

`:=`(A[2], .2) (51)
 

`:=`(A[3], 1) (51)
 

`:=`(A[4], 2) (51)
 

`:=`(A[5], .3) (51)
 

`:=`(A[6], .8) (51)
 

`:=`(A[7], .5) (51)
 

`:=`(A[8], 2) (51)
 

> w[1]:=4; w[2]:=1; w[3]:=5; w[4]:=17; w[5]:=6.5; w[6]:=13; w[7]:=8; w[8]:=12;
 

`:=`(w[1], 4) (52)
 

`:=`(w[2], 1) (52)
 

`:=`(w[3], 5) (52)
 

`:=`(w[4], 17) (52)
 

`:=`(w[5], 6.5) (52)
 

`:=`(w[6], 13) (52)
 

`:=`(w[7], 8) (52)
 

`:=`(w[8], 12) (52)
 

>
 

>
 

>
 

>
 

> Ag:=t->Re(g(t));
 

`:=`(Ag, proc (t) options operator, arrow; Re(g(t)) end proc) (53)
 

> plot(Ag,-5..5,numpoints=500, thickness=2);
 

Plot_2d
 

>
 

>
 

> Fg:=t->abs(int(exp(-2*Pi*I*x*t)*g(x),x=-infinity..infinity));
 

`:=`(Fg, proc (t) options operator, arrow; abs(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(g(x))), x = `+`(`-`(infinity)) .. infinity)) end proc) (54)
 

 

> plot({Fg}, 0..20, tickmarks=[20,10] thickness=2);
 

Plot_2d
 

>
 

>
 

>
 

>
 

>
 

>
 

> ---------------------------------------------------------------------------------------------------------------
 

>
 

La trasformata di Fourier di Gaussiane dilatate
 

> g1:=t->exp(-A*t^2)*exp(2*Pi*I*b*t);
 

`:=`(g1, proc (t) options operator, arrow; `*`(exp(`+`(`-`(`*`(A, `*`(`^`(t, 2)))))), `*`(exp(`*`(`*`(2, `*`(I)), `*`(Pi, `*`(b, `*`(t))))))) end proc) (55)
 

> g2:=t->exp(-B*t^2)*exp(2*Pi*I*c*t);
 

`:=`(g2, proc (t) options operator, arrow; `*`(exp(`+`(`-`(`*`(B, `*`(`^`(t, 2)))))), `*`(exp(`*`(`*`(2, `*`(I)), `*`(Pi, `*`(c, `*`(t))))))) end proc) (56)
 

> A:=0.5;B:=10; b:=10; c:=10;
 

`:=`(A, .5) (57)
 

`:=`(B, 10) (57)
 

`:=`(b, 10) (57)
 

`:=`(c, 10) (57)
 

 

> Rg1:=t->Re(g1(t));
 

`:=`(Rg1, proc (t) options operator, arrow; Re(g1(t)) end proc) (58)
 

> plot(Rg1,-5..5, numpoints=500, thickness=2);
 

Plot_2d
 

> Rg2:=t->Re(g2(t));
 

`:=`(Rg2, proc (t) options operator, arrow; Re(g2(t)) end proc) (59)
 

> plot(Rg2,-5..5, numpoints=500, thickness=2);
 

Plot_2d
 

> Fg1:=t->abs(int(exp(-2*Pi*I*x*t)*g1(x),x=-infinity..infinity));
 

`:=`(Fg1, proc (t) options operator, arrow; abs(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(g1(x))), x = `+`(`-`(infinity)) .. infinity)) end proc) (60)
 

> Fg2:=t->abs(int(exp(-2*Pi*I*x*t)*g2(x),x=-infinity..infinity));
 

`:=`(Fg2, proc (t) options operator, arrow; abs(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(g2(x))), x = `+`(`-`(infinity)) .. infinity)) end proc) (61)
 

> plot({Fg1,Fg2}, 0..20, thickness=2);
 

Plot_2d
 

Commento: La traformata del segnale di durata maggiore risulta piu' concentrata vicino alla frequenza contenuta .... e' come se la trasformata di Fourier  "avendo piu' tempo per esaminare la frequenza fosse piu' sicura della risposta"! 

>
 

>
 

>
 

>
 

>
 

Il valore assoluto della trasformata di Fourier non segnala "quando" appaiono frequenze in un segnale
 

 

 

> g1:=t->exp(-A*t^2)*exp(2*Pi*I*b*t);
 

`:=`(g1, proc (t) options operator, arrow; `*`(exp(`+`(`-`(`*`(A, `*`(`^`(t, 2)))))), `*`(exp(`*`(`*`(2, `*`(I)), `*`(Pi, `*`(b, `*`(t))))))) end proc) (62)
 

> g2:=t->g1(t-5);
 

`:=`(g2, proc (t) options operator, arrow; g1(`+`(t, `-`(5))) end proc) (63)
 

> A:=3.14;
 

`:=`(A, 3.14) (64)
 

> b:=4;
 

`:=`(b, 4) (65)
 

> Rg1:=t->Re(g1(t));
 

`:=`(Rg1, proc (t) options operator, arrow; Re(g1(t)) end proc) (66)
 

> plot(Rg1,-10..10,numpoints=500, thickness=2);
 

Plot_2d
 

> Rg2:=t->Re(g2(t));
 

`:=`(Rg2, proc (t) options operator, arrow; Re(g2(t)) end proc) (67)
 

> plot(Rg2,-10..10,numpoints=500, thickness=2);
 

Plot_2d
 

> Fg1:=t->abs(int(exp(-2*Pi*I*x*t)*g1(x),x=-infinity..infinity));
 

`:=`(Fg1, proc (t) options operator, arrow; abs(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(g1(x))), x = `+`(`-`(infinity)) .. infinity)) end proc) (68)
 

> Fg2:=t->abs(int(exp(-2*Pi*I*x*t)*g2(x),x=-infinity..infinity));
 

`:=`(Fg2, proc (t) options operator, arrow; abs(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(x, `*`(t))))))), `*`(g2(x))), x = `+`(`-`(infinity)) .. infinity)) end proc) (69)
 

> plot(Fg1, 0..20, thickness=2);
 

Plot_2d
 

> plot(Fg2, 0..20, thickness=2);
 

Plot_2d
 

 

 

Commenti:  

I grafici dei valori assouti delle trasformate di   g1(t)  e  g1(t-5)   sono identici !!! 

(Solo tramite prendendo in considerazione anche la fase complessa della traformata di Fourier sarebbe possibile risalire al ritardo di tempo tra i due segnali, l'informazione temporale è quindi presente ma codificata in un modo di non facile lettura).  

 

Metaforicamente: "La trasformata di Fourier (in valore assoluto) e' come un orecchio che sente le note ma non ricorda quando sono state suonate". 

Questo difetto verra' superato con l'introduzione della Trasformata di Gabor. 

>
 

>
 

>
 

>
 

>
 

>
 

>
 

TRASFORMATA DI GABOR
 

______________________________________________________________________________
 

A differenza della trasformata di Fouier, la trasormata di Gabor di un segnale è una funzione di due variabili: x=tempo, w=frequenza. 

Essa fornisce indicazioni sia sulle frequenze che sul tempo in cui esse compaiono nel sengale. Si tratta quindi di un "orecchio" che oltre a  

"sentire" sa anche "ricordare quando ha sentito". Matematicamente ciò avviene "tagliando" il segnale con la moltiplicazione per una funzione  

"finestra" che viene spostata nel tempo, successivamente viene applicata la trasformata di Fourier al segnale tagliato. In tal modo la trasformata  

di Fourier coinvolge soltanto le frequenze che "cadono nella finestra" e non tutte le frequenze presenti nel segnale. 

______________________________________________________________________________ 

>
 

>
 

>
 

Segnale: 

> f:=t->piecewise(t<-10,0,t<0,sin(2*Pi*t),t<10,sin(2*Pi*3*t),0);
 

`:=`(f, proc (t) options operator, arrow; piecewise(`<`(t, -10), 0, `<`(t, 0), sin(`+`(`*`(2, `*`(Pi, `*`(t))))), `<`(t, 10), sin(`+`(`*`(6, `*`(Pi, `*`(t))))), 0) end proc) (70)
 

Finestra tipo gaussiano: 

> g:=t->exp(-2*t^2);
 

`:=`(g, proc (t) options operator, arrow; exp(`+`(`-`(`*`(2, `*`(`^`(t, 2)))))) end proc) (71)
 

> plot(f,-10..10, thickness=2);
 

Plot_2d
 

> plot(g,-3..3, thickness=2);
 

Plot_2d
 

 

 

Trasformata di Gabor (o "short-time Fourier transform"= STFT) del segnale  f  con finestra  g: 

 

 

> with(plots):
 

> STFT:=(x,w)->abs(int(exp(-2*Pi*I*w*t)*f(t)*g(t-x),t=-infinity..infinity));
 

`:=`(STFT, proc (x, w) options operator, arrow; abs(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(w, `*`(t))))))), `*`(f(t), `*`(g(`+`(t, `-`(x)))))), t = `+`(`-`(infinity)) .. infinity)) e... (72)
 

> plot3d(STFT(x,w),x=-5..5,w=0..5);
 

Plot
 

> plot3d(STFT(x,w),x=-5..5,w=0..5);
 

Plot
 

>
 

>
 

>
 

>
 

>
 

TRASFORMATA DI GABOR DI UN SEGNALE CON FREQUENZA CHE AUMENTA NEL TEMPO A PARTIRE DALL'ISTANTE ZERO
 

 

> f:=t->piecewise(t<-10,0,t<0,sin(2*Pi*t),t<10,sin(Pi*t^2),0);
 

`:=`(f, proc (t) options operator, arrow; piecewise(`<`(t, -10), 0, `<`(t, 0), sin(`+`(`*`(2, `*`(Pi, `*`(t))))), `<`(t, 10), sin(`*`(Pi, `*`(`^`(t, 2)))), 0) end proc) (73)
 

> g:=t->exp(-2*t^2);
 

`:=`(g, proc (t) options operator, arrow; exp(`+`(`-`(`*`(2, `*`(`^`(t, 2)))))) end proc) (74)
 

> plot(f,-10..10, thickness=2, numpoints=500);
 

Plot_2d
 

> plot(g,-3..3, thickness=2);
 

Plot_2d
 

> with(plots):
 

> STFT:=(x,w)->abs(int(exp(-2*Pi*I*w*t)*f(t)*g(t-x),t=-infinity..infinity));
 

`:=`(STFT, proc (x, w) options operator, arrow; abs(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(w, `*`(t))))))), `*`(f(t), `*`(g(`+`(t, `-`(x)))))), t = `+`(`-`(infinity)) .. infinity)) e... (75)
 

> plot3d(STFT(x,w),x=-5..5,w=-5..5,numpoints=2000);
 

Plot
 

>
 

>
 

>
 

Plot
 

>
 

>
 

>
 

>
 

>
 

>
 

>
 

 

Rappresentazione tempo-frequenza tramite trasformate di Gabor con finestre diverse 

 

 

> with(plots):
 

> f:=t->piecewise(t<-10,0,t<0,sin(2*Pi*t),t<10,sin(2*Pi*3*t),0);
 

`:=`(f, proc (t) options operator, arrow; piecewise(`<`(t, -10), 0, `<`(t, 0), sin(`+`(`*`(2, `*`(Pi, `*`(t))))), `<`(t, 10), sin(`+`(`*`(6, `*`(Pi, `*`(t))))), 0) end proc) (76)
 

> g:=t->exp(-5*t^2);
 

`:=`(g, proc (t) options operator, arrow; exp(`+`(`-`(`*`(5, `*`(`^`(t, 2)))))) end proc) (77)
 

> gg:=t->exp(-(1/5)*t^2);
 

`:=`(gg, proc (t) options operator, arrow; exp(`+`(`-`(`*`(`/`(1, 5), `*`(`*`(`^`(t, 2))))))) end proc) (78)
 

> plot(f,-10..10,thickness=2);
 

Plot_2d
 

> STFT:=(x,w)->abs(int(exp(-2*Pi*I*w*t)*f(t)*g(t-x),t=-infinity..infinity));
 

`:=`(STFT, proc (x, w) options operator, arrow; abs(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(w, `*`(t))))))), `*`(f(t), `*`(g(`+`(t, `-`(x)))))), t = `+`(`-`(infinity)) .. infinity)) e... (79)
 

> STFT2:=(x,w)->abs(int(exp(-2*Pi*I*w*t)*f(t)*gg(t-x),t=-infinity..infinity));
 

`:=`(STFT2, proc (x, w) options operator, arrow; abs(int(`*`(exp(`+`(`-`(`*`(`+`(`*`(2, `*`(I))), `*`(Pi, `*`(w, `*`(t))))))), `*`(f(t), `*`(gg(`+`(t, `-`(x)))))), t = `+`(`-`(infinity)) .. infinity))... (80)
 

Grafico trasformata Gabor con finestra "stretta": 

> plot3d(STFT(x,w),x=-5..5,w=0..5);
 

Plot
 

>
 

>
 

Grafico trasformata Gabor con finestra "larga": 

> plot3d(STFT2(x,w),x=-5..5,w=0..5);
 

Plot
 

>
 

Miglioramento della rappresentazione tempo-frequenza tramite moltiplicazione di 2 trasformate di Gabor con finestre diverse 

Grafico del prodotto delle precedenti trasformate di Gabor: 

> plot3d(STFT2(x,w)*STFT(x,w),x=-5..5,w=0..5);
 

Plot
 

>
 

Stessi grafici visti dall'alto: 

>
 

> plot3d(STFT(x,w),x=-5..5,w=0..5);
 

Plot
 

> plot3d(STFT2(x,w),x=-5..5,w=0..5);
 

Plot
 

> plot3d(STFT2(x,w)*STFT(x,w),x=-5..5,w=0..5);