# Matlab: Rectangular Window or von Hann (Hanning) Window

Assume the signal consist of a sum of 3 sinusoids (sine functions, no phase delay). One sine is at 50hz, the second is at 60hz, and the third is at 75 Hz. The 50hz and 60hz sines have a peak magnitude of 1, the 75hz sine has a peak magnitude of .1. Assume the combined signal is sampled at 240hz, and 256 samples of the signal are available.

Perform the following using a rectangular window and a von Hann (Hanning) window.

[1] For the two windows, window the received signal (multiply received signal by the time domain), using a window length of 64, 128, and 256 (a total of 6 windowed signals). For the smaller length windows, you will need to zero pad the window until its length equals 256.

[2] For each windowed signal above, perform a 256 pt FFT (using the fft function in matlab).

[3] Compare the frequency response magnitudes for each of the responses above (will need to plot on a logarithmic scale). Comment on the observations noting things such as if the signals are resolvable, the size of the side lobes, etc. How does the FT of a rectangular window explain the trends in the graphs?

I am still learning Matlab and am lost on this practice problem. Please write the routine and comment on what is being asked for.

Â© BrainMass Inc. brainmass.com March 4, 2021, 6:06 pm ad1c9bdddfhttps://brainmass.com/engineering/electrical-engineering/matlab-rectangular-window-von-hann-hanning-window-28976

#### Solution Preview

Signal consists of a sum of 3 sinusoids (sine functions, no phase delay). One sine is at 50 Hz, the second is at 60 Hz, and the third is at 75 Hz. The 50 Hz and 60 Hz sines have a peak magnitude of 1; the 75 Hz sine has a peak magnitude of 0.1.

% Sampling frequency 240 Hz

% Number of samples 256

fs= 240;

ts= 1/240;

N=256;

w1 = 2*pi*50; w2 = 2*pi*60;w3= 2*pi*75;

t = [0:ts:ts*(N-1)];

% The combined signal

x = sin(w1*t) + sin(w2*t) + 0.1*sin(w3*t);

plot(x);

Rectangular window

1) % ...

#### Solution Summary

The attached Word file has Matlab code with plots and explanation.