Determination of Psd with Wave Forms

By // No comments:
clc;
clear all;
close all;
N=1024;
fs=8000;
f1=input('enter the 1st freuency');
f2=input('enter the 2nd freuency');
f3=input('enter the 3rd freuency');
n=0:N-1;
x=sin(2*pi*(f1/fs)*n)+sin(2*pi*(f2/fs)*n)+sin(2*pi*(f3/fs)*n);
figure(1)
pxx=spectrum(x,N)
specplot(pxx,fs);
grid ON;
xlabel('freq hz');
ylabel('mag in db');
title('power spectrum of x(n)');


Impulse Response of a First Order and Second Order System with Wave Forms

By // 1 comment:
clc;
clear all;
close all;
a=input('enter the numerator coefficient value');
b=input('enter the denominator coefficient value');
N=input('enter the number of samples');
[h,t]=impz(a,b,N);
disp('h=')
disp(h)
stem(t,h);
xlabel('samples');
ylabel('amplitude');
title('impulse response');

Dual Tone Multi Frequency with Waveforms

By // No comments:
clc;
clear all;
close all;
fs=8000;
f1=770+/fs;
f2=1209/fs;
n=1:205;
x1=sin(2*pi*f1*n);
x2=sin(2*pi*f2*n);
x=x1+x2;
y=fft(x,205);
K=1:50;
z(K)=y(K);
stem(K,abs(z));
xlabel('k');
ylabel('amplitude');
title('DTMF signal');


Implementation of Decimation / Interpolation Process with Waveforms

By // No comments:
clc;
clear all;
close all;
t=0:0.01:1;
d=input('enter number D/I');
x=sin(2*pi*5*t);
y=decimate(x,d);
subplot(3,1,1);
stem(x(1:25));
title('original input signal');
xlabel('samples');
ylabel('amplitude');
subplot(3,1,2);
stem(y);
title('decimated output');
xlabel('samples');
ylabel('amplitude');
y1=interp(y,d);
subplot(3,1,3);
stem(y1(1:25));
title('interpolation output');
xlabel('samples');
ylabel('amplitude');


Implementation of Decimation Process with Waveforms

By // No comments:
clc;
clear all;
close all;
x=input('enter the sequence');
d=input('enter the decimation factor');
N=length(x);
n=0:N-1;
xd=x(1:d:N);
n1=1:N/d;
subplot(2,1,1);
stem(n,x);
title('input signal');
xlabel('samples');
ylabel('amplitude');
subplot(2,1,2);
stem(n1-1,xd);
title('decimated output');
xlabel('samples');
ylabel('amplitude');

FFT and Convolution for FFT with Waveforms

By // No comments:
clc;
clear all;
close all;
x=input('enter the sequence');
N=input('enter the number of smples');
n=0:N-1
y=fft(x,N);
y1=abs(y);
y2=angle(y);
y3=ifft(y);
figure(1);
subplot(2,1,1);
stem(x);
title('original signal');
xlabel('samples');
ylabel('amplitude');
subplot(2,1,2);
stem(y);
title('fft signal');
xlabel('samples');
ylabel('amplitude');
figure(2);
subplot(2,1,1);
stem(y1);
title('magnitude plot');
xlabel('samples');
ylabel('amplitude');
subplot(2,1,2);
stem(y2);
title('phase angle');
xlabel('samples');
ylabel('amplitude');
figure(3);
subplot(2,1,1);
stem(y);
title('frequency domain sequence');
xlabel('samples');
ylabel('amplitude');
subplot(2,1,2);
stem(y3);
title('invers fft signal');
xlabel('samples');
ylabel('amplitude');





% CONV FOR FFT
clc;
clear all;
close all;
x=input('enter sequence of x');
h=input('enter sequence of h');
X1=[x zeros(1,length(h)-1)];
disp('X1=');
disp(X1);
h1=[h zeros(1,length(x)-1)];
disp('h1=');
disp(h1);
X=fft(x1);
H=fft(h1);
y=X.*H;
y1=ifft(y);
disp('the conv y1=');
disp(y1);
figure(1);
subplot(5,1,1);
stem(x);
title('input signal 1');
xlabel('samples');
ylabel('amplitude');
subplot(5,1,2);
stem(h);
title('input signal 2');
xlabel('samples');
ylabel('amplitude');
subplot(5,1,3);
stem(X1);
title('fft signal 1');
xlabel('samples');
ylabel('amplitude');
subplot(5,1,4);
stem(h1);
title('fft signal 2');
xlabel('samples');
ylabel('amplitude');
subplot(5,1,5);
stem(y1);
title('conv signal');
xlabel('samples');
ylabel('amplitude');

DFT and IDFT with Wave Forms

By // No comments:
clc;
clear all;
close all;
x=input('enter the input sequence');
L=length(x);
N=input('enter number of samples');
xn=[x zeros(1,N-L)]
n=[0:1:N-1]
k=[0:1:N-1]
wN=exp(-j*2*pi/N);
nk=n'*k;
wNnk=wN.^(nk);
xk=xn*wNnk;
disp('dft of given sequence');
disp(xk);
figure(1);
subplot(2,1,1);
stem(k,xn);
title('original samples');
xlabel('samples');
ylabel('amplitude');
subplot(2,1,2);
stem(k,xk);
title('discrete fourier transform');
xlabel('samples');
ylabel('amplitude');
figure(2)
subplot(2,1,1);
stem(k,abs(xk));
title('magnitude response');
xlabel('samples');
ylabel('amplitude');
subplot(2,1,2);
stem(k,angle(xk));
title('phase response');
xlabel('frequency');
ylabel('amplitude');


       % IDFT
clc;
clear all;
close all;
x=input('enter the input sequence');
L=length(x);
N=input('enter number of samples');
xk=[x zeros(1,N-L)]
n=[0:1:N-1]
k=[0:1:N-1]
wN=exp(-j*2*pi/N);
nk=n'*k;
wNnk=wN.^(-nk);
xn=(xk*wNnk)/N;
disp('dft of given sequence');
disp(xk);
figure(1);
subplot(2,1,1);
stem(k,xk);
title('original samples');
xlabel('samples');
ylabel('amplitude');
subplot(2,1,2);
stem(k,xn);
title('discrete fourier transform');
xlabel('samples');
ylabel('amplitude');