Asked by Janusz Rogalski
on 6 Jan 2019

I have a signal that I'm trying to analyze using FFT and rectangular window. However I am not sure how to adjust the value of "t" and use rectangular window on this signal to perform correct analysis Can you please tell me what am I doing wrong? Thank you in advance.

clear

close all

clc

fs=2000;

T=1/fs;

t=0:T:(1-T);

y=sin(200*t.*sin(60*t));

% Plot signal

figure(1);

plot(t,y);

title('Signal');

xlabel('Time [s]');

ylabel('Amplitude');

% Spectrum

figure

widmo=(abs(fft(y)));

stem(widmo);

title('Spectrum')

grid on;

axis tight;

xlabel('Frequency [Hz]');

ylabel('Amplitude')

% Rectangular window

N = length(y);

w = window(@boxcar,fs);

okno = y.*w';

figure;

plot(t,okno);

figure;

bar(abs(fft(okno)));

Opportunities for recent engineering grads.

Apply Today
## 5 Comments

## dpb (view profile)

Direct link to this comment:https://es.mathworks.com/matlabcentral/answers/438511-signal-analysis-need-help-with-fft#comment_657443

## Janusz Rogalski (view profile)

Direct link to this comment:https://es.mathworks.com/matlabcentral/answers/438511-signal-analysis-need-help-with-fft#comment_657454

## dpb (view profile)

Direct link to this comment:https://es.mathworks.com/matlabcentral/answers/438511-signal-analysis-need-help-with-fft#comment_657463

## David Goodmanson (view profile)

Direct link to this comment:https://es.mathworks.com/matlabcentral/answers/438511-signal-analysis-need-help-with-fft#comment_657483

## dpb (view profile)

Direct link to this comment:https://es.mathworks.com/matlabcentral/answers/438511-signal-analysis-need-help-with-fft#comment_657740

Sign in to comment.