0
$\begingroup$

How to show the time history of a signal down-sampled under the rates of 25Hz & 40Hz and find its DFT analysis using Matlab ? The sample signal is in a data file (sensor_data.mat) its sampling rate is 1000Hz.

I can get the time history and the DFT analysis of the signal.

Fs = 1000; % sampling rate
T=1/Fs; % sample time
L= 20000; % lenght of signal
t=(0:L-1)*T; % time vector
figure(1)
plot(t,u)
grid;
title('Time History of the Signal')
% dft analysis
yf=fft(u);
w=[0:2*pi/L:(L-1)*2*pi/L];
figure(2)
plot(w/(2*pi*T),abs(yf))
grid
title('DFT analysis of the signal sampled at 1000Hz')

But how do I down-sample it ? I know Matlab has a function for it (downsample), but I'm not getting any correct answers.

Also how do I find the signals frequency range and amplitude over its frequency range from the DFT analysis ?

Thanks in advance, Please help !!

$\endgroup$
  • 1
    $\begingroup$ 1. Read the documentation for fftshift. 2. Explain why you think your results are incorrect -- what did you expect, and what did you get. $\endgroup$ – MBaz May 18 '15 at 23:03
  • $\begingroup$ I want to downsample the signal not shift it !! And when I downsample the signal to 25hz : downsample('sensor_data', 25) and plot it I get the same time history plot before downsampling it. $\endgroup$ – shakDroid May 19 '15 at 13:12
  • $\begingroup$ You need to read the documentation for those commands, carefully. They don't work the way you're assuming they do. $\endgroup$ – MBaz May 19 '15 at 13:24
  • $\begingroup$ The documentation for downsample just states to enter the value by which we want to downsample the signal. But given the value is in hertz, I'm assuming I need to convert it ? $\endgroup$ – shakDroid May 19 '15 at 13:38
  • $\begingroup$ That value is a factor. If signal x is sampled at 1000 Hz, then y=downsample(x,10) is sampled at 1000/10=100 Hz. $\endgroup$ – MBaz May 19 '15 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.