fftexp - Yf = abs(fft(y,N)); %Computing the N-point fft Yf...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
clear all; close all; clc %How to view the spectrum of a signal using FFT in Matlab t = [0:255]; %time vector y = exp(2*pi*t/50); %given signal(fundamental frequency is 1/10) figure; plot(y); xlabel('time'); ylabel('amplitude'); grid; title('Approximate Spectrum of a Sinusoid with the FFT'); N = 2048; %# of fft points (or frequency pints)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Yf = abs(fft(y,N)); %Computing the N-point fft Yf = fftshift(Yf); %shift the zero-frequency component to center of spectrum f = [-N/2:N/2-1]/N;%the x axis which is the normalized frequency f figure plot(f, Yf), xlabel('frequency / fs') grid; title('Approximate Spectrum of a Sinusoid with the FFT');...
View Full Document

Ask a homework question - tutors are online