How to make the fft of a signal while receiving it?

1 view (last 30 days)
Hello everyone. Thanks for reading. I need some help to solve a problem that i have.
I am digitalizing a signal through a dsPic which samples de signal at 8000hz, and then send's them to the Pc where i receive then with matlab to make the fft. I receive 8000 samples and then i do the fft, so, i can do a fft once per second.
t = 0:1:7999; % time Fs = 8000; % sample frec Ts = 1/Fs; % period y = sin(2*pi*1500*t*Ts); % imagine this signal is the received one Y=abs(fftshift(fft(y)))/4000; stem(0:Fs/2-1,Y(Fs/2+1:end))
What I would like to do, if possible, is to increse the refresh rate of the fft. So i thought i would do the fft with the first 20 bytes received, and then with the following 20 and so on, until the 8000 slot fifo buffer is completed.
Thats it, I hope you can understad what I mean. Thanks!

Answers (1)

Chibuzo Nnonyelu
Chibuzo Nnonyelu on 1 Mar 2013
I recommend you add timer to your code. Let the timer re-initiate the same process after the specified interval.
t = timer('TimerFcn','_your_sampling_function_([var])',... 'StartDelay',0.5,'ExecutionMode','fixedDelay',... 'BusyMode','drop','Period',1); % start(t); % stop(t); % delete(t);
Read more on this 'timer' function.


Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by