Question

Problem 2 (Spectrum of a rectangular signal): In this problem, the amplitude spectrum of the signal 1 or Ot 2 ms x(t)- 0 othe

(b) Numerical calculation of the spectrum: (i) Use Matlab to generate and plot a vector containing the sample values of the r

Problem 2 (Spectrum of a rectangular signal): In this problem, the amplitude spectrum of the signal 1 or Ot 2 ms x(t)- 0 otherwise is to be analysed
(b) Numerical calculation of the spectrum: (i) Use Matlab to generate and plot a vector containing the sample values of the rectangular signal defined in (2) sampled at f 8kHz. Choose the number N of sample values so that it is a power of 2 and that the signal duration is at least 4 ms. Do not forget to label the axes of your plot. Matlab's fft function to (ii) Use plot the amplitude spectrum in the frequency range [0, fs/2]. Make sure that the frequency axis is labelled correctly.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

MATLAB:


clc;close all;clear all;
T=4*(10^(-3))
T1=2*(10^(-3))
t=0:T/200:T
x=(t<=T1)
subplot(221)
plot(t,x,'m')
title('Rectangular function')
xlabel('t')
ylabel('x(t)')


fs=8000
Ts=1/fs
n=0:1:T/Ts
x=(n<=T1/Ts)
subplot(222)
stem(n,x,'b')
title('Sampled Rectangular function')
xlabel('n')
ylabel('x(n)')

X=fft(x)
N=length(n)
f=0:fs/(2*(N-1)):fs/2
subplot(223)
stem(f,abs(X),'r')
hold on
plot(f,abs(X),'b--')
xlabel('f')
ylabel('|X(f)|')
title('Amplitude spectrum')
hold off

Rectangular function Sampled Rectangular function 0.8 0.6 0.4 0.2 0.8 0.6 0.4 0.2 0 0.001 0.002 0.003 0.004 0 5 10 15 20 25 3

Add a comment
Know the answer?
Add Answer to:
Problem 2 (Spectrum of a rectangular signal): In this problem, the amplitude spectrum of the signal 1 or Ot 2 ms x(t)- 0 otherwise is to be analysed (b) Numerical calculation of the spectrum: (i) Us...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT