Do a zoom in a FFT trasform
8 views (last 30 days)
Show older comments
Domenico Domenico on 16 Apr 2016
Commented: Domenico Domenico on 18 Apr 2016
Hi, i do this exercise, but i dont know how to do a zoom in a fft function. I want that my plot go from fc-span/2 to fc+span/2, where span is an input value. i want to see only a part of my fft trasform, and not the all spectrum.
Esercize: Design a MATLAB function that accepts the following input parameters: the frequency f0 of the input sinewave the amplitude A of the input sinewave center frequency span window vertical scale. As far as f0, A, center frequency and span go, they have to be numerical input variables. Instead the remaining input variables values have to be chosen among a pre-dened set of values that can be specied in the help of the function. The function output is the plot of the measured spectrum. Remember to set the x-axis and y-axis labels.
This is my code:
function FFT_Analyzer(f0, A,center_freq, span, window)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
fs=f0*5; %sampling rate choisen in order to respect Nyquist Theorem
ts=1/fs; %sapling time
m=256; %window length
Tobs=m*ts; %observation time
% function for set the imposed center frequency
% function to trasform an arbitrary span into a cardinal span
N=fs/(2*s1); %decimation factor
df=fs/N; %new resolution
% if cicle to choise the window to use in the windowing process
display('use hamming, hanning, flattop, rectangular for the window')
Remember i dont know how to implemet the zoom function in my code, to have a video not the all spectrum, but only a range that i decide whit the value on span in the function.
Ced on 16 Apr 2016
You can specify the portion of the plot displayed using xlim, ylim, or axis (for both x and y). This will not change what you are actually plotting, only what you see.
xlim([ 0 0.25*fs])
More Answers (0)
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!