home
clear
home
doc
fs = 100;                          % Sample frequency (Hz)
t = 0:1/fs:10-1/fs;                % 10 sec sample
x = (1.3)*sin(2*pi*15*t) ...       % 15 Hz component
+ (1.7)*sin(2*pi*40*(t-2)) ...   % 40 Hz component
+ (2.5)*randn(size(t));          % Gaussian noise;
figure, plot( t, x )
x = (1.3)*sin(2*pi*15*t) ...       % 15 Hz component
+ (1.7)*sin(2*pi*40*(t-2)) ...   % 40 Hz component
+ (0.1)*randn(size(t));          % Gaussian noise;
figure, plot( t, x )
x = (1.3)*sin(2*pi*1*t) ...
+ (1.7)*sin(2*pi*4*(t-2)) ...
+ (0.1)*randn(size(t));
figure, plot( t, x )
m = length(x);          % Window length
n = pow2(nextpow2(m));  % Transform length
y = fft(x,n);           % DFT
f = (0:n-1)*(fs/n);     % Frequency range
power = y.*conj(y)/n;   % Power of the DFT
plot(f,power)
xlabel('Frequency (Hz)')
ylabel('Power')
title('{\bf Periodogram}')
figure, plot(f(1:51),power(1:51), 'r')
figure, plot(f(1:513),power(1:513), 'r')
plot(f,power)
xlabel('Frequency (Hz)')
ylabel('Power')
title('{\bf Periodogram}')
figure, plot(f(1:513),power(1:513), 'r')
home
help wavrecord
Fs = 11025;
y = wavrecord( 10*Fs, Fs );
t = (1:10*Fs)/Fs;
figure, plot( t, y )
Y = fft( y );
n = length(y);
f = (0:n-1)*(Fs/n);     % Frequency range
power = y.*conj(y)/n;   % Power of the DFT
figure, plot( f, power )
power = Y.*conj(Y)/n;   % Power of the DFT
figure, plot( f, power )
vF = [ 190.7 377.5 562.5 745.9 ]
nF = [1 2 3 4]
figure, plot( n, vF, '*' )
figure, plot( nF, vF, '*' )
help ginput
[gx,gy,gb] = ginput
gx
gn = [1;2;3;4;5;6]
figure, plot( gn, gx, '*' )
help spectrogram
spectrogram( y, 1000, 500, Fs, 1000, 'yaxis');
spectrogram( y, 1000, 500, 1000, Fs, 'yaxis');
set( gca, 'fontsize', 18 )
yG = wavrecord( 10*Fs, Fs );
figure, plot( t, y )
figure, plot( t, yG )
spectrogram( yG, 1000, 500, 1000, Fs, 'yaxis');
yW = wavrecord( 10*Fs, Fs );
figure, plot( t, yW )
figure, spectrogram( yW, 1000, 500, 1000, Fs, 'yaxis');
yD = wavrecord( 10*Fs, Fs );
figure, plot( t, yD )
figure, spectrogram( yD, 1000, 500, 1000, Fs, 'yaxis');