GUI Development Using MATLAB For FFT
GUI Development Using MATLAB For FFT
Date: 09.05.2013
1. Motivation 2. Objectives 3. Discrete Fourier Transform (DFT) 4. Fast Fourier Transform (FFT) 5. Windowing 5.1 Rectangular Window 5.2 Hamming Window 5.3 Hanning Window 6. Some MATLAB Functions 7. GUI-control Elements 8. GUI-control Elements Properties 9. GUIDE
9.1 Layout Editor 9.2 Property Inspector 9.3 Object Browser 9.4 Menu Editor 10. GUI Layout Design 11. Algorithm for designed GUI 12. Use of CallBack Function 13. MATLAB code for FFT 14. Output Snapshots 15. Conclusion References
To develop and implement GUI for FFT Other requirements 1.Two separte plots for input and output signal. 2.Cosine signal as input signal. 3.Frequency spectrum of FFT of input as output. 4.Demonstration of leakage effect. 5.Windowing demonstration 6.Sliders to change input and output signal characteristics.
A signal can be collection of frequency components. Extracts the signal component F() at frequency Mathematically represented as,
Algorithm to calculate DFT fast and efficiently. First published in 1965 by Cooley and Tuckey. Applies only to signals with elements 2m. FFT returns set of complex numbers. But, real numbers for f=0 and f= fs /2.
Output spectrum of DFT has spectral leakage. Windowing minimize spectal leakage. DFT of x[i]w[i] is done. Different types of window functions available. 1.Rectangular Window 2.Hanning Window 3.Hamming Window
W[n] = 1 =0
Y = fft(x) returns the DFT of vector x, [2]. w = hamming(L) returns an L-point symmetric Hamming window in the column vector w, [2]. w = hann(L) returns an L-point symmetric Hann window in the column vector w, [2].
Stands for GUI Development Enviornment MATLAB tool to create GUI Easy to use Components of GUIDE 1.Layout Editor 2.Property Inspector 3.Object Browser 4.Menu Editor
Step 1: Start Step 2: Set the value of slider 1, slider 2, slider 3 and slider 4 to zero. Step 3: Reset Hanning and Hamming Window. Step 4: Compute FFT length using slider 4 value and show in edit text box 4. Step 5: Set the rectangular window. Step 6: Show slider 1, slider 2, and slider 3 values in edit text box 1, edit text box 2 and edit text box 3 respectively. Step 7: Compute FFT length using slider 4 value and show in edit text box 4.
Step 8: Compute input signal array for currently active window and current sliders values. Step 9: Compute FFT and output signal array. Step 10: Plot input signal in axes 1 and output signal in axes 2. Step 11: If slider 1 or slider 2 or slider 3 or slider 4 has new value then go to step 4. Step 12: If edit text box 1 or edit text box or edit text box 3 or edit text box 4 have new value, set the value of respective slider. Go to step 6. Step 13: If Hanning window is set, reset the hamming window and rectangular window.
Go to step 8. Step 14: If Hamming window is set, reset the hanning window and rectangular window. Goto step 8. Step 15: If hanning and hamming both are reset, compute rectangular window vector. Goto step 8. Step 16: Stop
k=fft_length(s3) ; % function fft_length() returns number of fft points if k >1 fftval=fft(x,k); % calculate array of fft for k points indexnyquist=(k/2)+1; %centre FFT point fftval=fftval(1:indexnyquist); %truncate the negative parts k=cast(k,'double'); fftval=fftval/k; %scale %whos k fftval(2:end)=2*fftval(2:end); %compensate for truncating df=fs/k ; %discrete frequency interval frequency_axis=(0:indexnyquist-1)*df; %array of frequency to plot magnitude=abs(fftval); % magnitude of spectrum plot_output(frequency_axis,magnitude); % plot the fft in frequency spectrum
GUIDE is a good tool for GUI designing. GUI for FFT was developed and implemented. GUI for other complex processes can be developed.
1.www.mathworks.de/academia/student_center/tutorials 2.www.mathworks.com 3.Discrete Time Signal Processing, Second Edition, Allan V Oppenheim 4.Graphics and GUIs with MATLAB, Third Edition, Patrick Marchand & O. Thomas Holland