DTSP Programs
DTSP Programs
N = 4;
wc = 1;
subplot(2,1,1);
plot(w, abs(h));
subplot(2,1,2);
plot(w, angle(h));
-------------------------------------------------------------
hpf butterworth
N = 4; % Filter order
wc = 1; % Cutoff frequency
subplot(2,1,1);
plot(w, abs(h));
subplot(2,1,2);
plot(w, angle(h));
bpf
N = 4; % Filter order
subplot(2,1,1);
plot(w, abs(h));
subplot(2,1,2);
plot(w, angle(h));
band stop
N = 4; % Filter order
subplot(2,1,1);
plot(w, abs(h));
subplot(2,1,2);
plot(w, angle(h));
lpf chebyshev
N = 4; % Filter order
wc = 1; % Cutoff frequency
Rp = 3; % Passband ripple in dB
subplot(2,1,1);
plot(w, abs(h));
subplot(2,1,2);
plot(w, angle(h));
N = 4; % Filter order
wc = 1; % Cutoff frequency
Rp = 3; % Passband ripple in dB
subplot(2,1,1);
plot(w, abs(h));
subplot(2,1,2);
plot(w, angle(h));
N = 4; % Filter order
Rp = 3; % Passband ripple in dB
subplot(2,1,1);
plot(w, abs(h));
subplot(2,1,2);
plot(w, angle(h));
N = 4; % Filter order
Rp = 3; % Passband ripple in dB
subplot(2,1,1);
plot(w, abs(h));
subplot(2,1,2);
plot(w, angle(h));
auto correlation
x = [1 2 3 4 5 6 7 8 9];
Rxx = xcorr(x);
x = [1 2 3 4 5];
h = [1 2 1];
subplot(3,1,2);
stem(h);
title('Impulse Response h');
xlabel('Time Index');
ylabel('Amplitude');
subplot(3,1,3);
stem(y);
title('Linear Convolution y');
xlabel('Time Index');
ylabel('Amplitude');
circular conv
y =cconv(x,h)
x = [1 2 3 4 5];
h = [1 2 1];
subplot(3,1,2);
stem(h);
title('Impulse Response h');
xlabel('Time Index');
ylabel('Amplitude');
subplot(3,1,3);
stem(y);
title('Circular Convolution y');
xlabel('Time Index');
ylabel('Amplitude');
To write a program to find the Discrete Fourier Transform and IDFT of the
given sequence
using MATLAB and plot the magnitude and phase response.
% Given sequence
x = [1 2 3 4 5];
% Compute DFT
X = fft(x);
% Compute IDFT
x_idft = ifft(X);
subplot(2,1,2);
stem(x_idft);
title('IDFT Sequence');
xlabel('Time Index');
ylabel('Amplitude');
fft
% Given sequence
x = [1 2 3 4 5];
% Compute FFT
X = fft(x);
% Compute IFFT
x_ifft = ifft(X);