To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
The primary repository for this project is hosted at git://github.com/rmeddis/MAP.git .
This repository is a read-only copy which is updated automatically every hour.
root / userProgramsTim / mellin_trafo.m
History | View | Annotate | Download (1.58 KB)
| 1 | 38:c2204b18f4a2 | rmeddis | function out = mellin_trafo(inx,iny) |
|---|---|---|---|
| 2 | |||
| 3 | %This function computes the Mellin Transformation of a one-dimensional |
||
| 4 | %Signal in analytical terms given as |
||
| 5 | % |
||
| 6 | % S(p)=Integral from 0 to infty of s(t) t^(p-1)dt |
||
| 7 | % Which equals |
||
| 8 | % S(c) = Integral from -Infty to Infty s(t)*exp(j*c*log(t))d(log(t)) |
||
| 9 | % |
||
| 10 | % taken from Irino and Patterson, Speech Communication 2002 Eq. (1) and (3) |
||
| 11 | % Tim Juergens, September 2011 |
||
| 12 | % |
||
| 13 | |||
| 14 | %Resample the Signal onto a log(t) axis |
||
| 15 | minimalx=min(inx); |
||
| 16 | maximalx=max(inx); |
||
| 17 | logarithmicx= exp([log(minimalx):(log(maximalx)-log(minimalx))/length(inx):log(maximalx)]); |
||
| 18 | logarithmicy= interp1(inx,iny,logarithmicx,'linear','extrap'); |
||
| 19 | %figure, semilogx(logarithmicx,logarithmicy); |
||
| 20 | |||
| 21 | %Absolute of the inverse Fourier-Transform of the resampled signal |
||
| 22 | out = abs(ifft(logarithmicy)); |
||
| 23 | %figure, plot(out(1:40)); |
||
| 24 | |||
| 25 | |||
| 26 | %%just to show that the mellin transform results in invariable patterns if |
||
| 27 | %%the formants are a constant ratio |
||
| 28 | % frequencies_short = [1:8:8000]; |
||
| 29 | % frequencies_long = [1:10:10000]; |
||
| 30 | % Intervals_long = 1./frequencies_long; |
||
| 31 | % Intervals_short = 1./frequencies_short; |
||
| 32 | % contoursin = sin(2*pi*0.00015.*frequencies_long).^2 |
||
| 33 | % figure, plot(frequencies_long,contoursin), hold on, plot(frequencies_short,contoursin,'r') |
||
| 34 | % xlabel('Frequency (Hz)')
|
||
| 35 | % ylabel('Rate (arb. units)')
|
||
| 36 | % figure, semilogx(Intervals_long,contoursin), hold on, plot(Intervals_short,contoursin,'r') |
||
| 37 | % xlabel('Interval (s)')
|
||
| 38 | % ylabel('Rate (arb. units)')
|
||
| 39 | % m1 = mellin_trafo(Intervals_long,contoursin); |
||
| 40 | % m2 = mellin_trafo(Intervals_short,contoursin); |
||
| 41 | % figure, plot(m1(1:40)), hold on, plot(m2(1:40),'r'); |
||
| 42 | % xlabel('Mellin variable c');
|
||
| 43 | % ylabel('Magnitude');
|
||
| 44 |