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.

Statistics Download as Zip
| Branch: | Revision:

root / userProgramsTim / fourier_analyse.m @ 38:c2204b18f4a2

History | View | Annotate | Download (926 Bytes)

1 38:c2204b18f4a2 rmeddis
function [frequency,out] = fourier_analyse(in, sfreq,color_plot)
2
%
3
%plots absolute values of fft of input signal on a semilogarithmic scale
4
%long term spectrum
5
%
6
%use:      [frequency,out] = fourier_analyse(in, sfreq)
7
%          in: input signal
8
%          sfreq: samplingfrequency
9
%          frequency: frequency vector
10
%          out: fourier-spectrum (complex)
11
if ~exist('color_plot')
12
    color_plot = 'b';
13
end
14
out = fft(in)/(length(in));  %%Normierung auf Wurzel der L?nge, da Matlab intern ohne Normierung der Hin-Fouriertransformation arbeitet
15
t = [0:1/sfreq:length(in)/sfreq-1/sfreq];
16
frequency = [0:1/t(end):1/(2*(t(2)-t(1)))];
17
%spektrale leistungsdichte wird geplottet, wobei eine amplitude von 1 100
18
%dB entspricht
19
plot(frequency,20*log10(sqrt(2)*abs(out(1:round(length(in)/2)))),color_plot);
20
%sqrt(2) weil Gesamtenergie auch in Spiegelfrequenzen enthalten
21
xlabel('frequency / Hz');
22
ylabel('fourier amplitude / dB');