NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Exp 6

clc;
clear all;
close all;
w=input('Enter the cut off freq');
N=input('No. of samples');
wc= 2*pi*w;
alpha= (N-1)/2;
eps= 0.001;
for n= 0:1:N-1
hd(n+1)=sin(-wc*(n-alpha+eps))/(pi*(n-alpha+eps));
end
wr=ones(1,N);
hn=hd.*wr;
w=0:0.01:pi;
h=freqz(hn,1,w);
subplot(1,3,1);
plot(w/pi,abs(h),'b');
grid;
xlabel('Nnormalised Freq');
ylabel('Mag');
title('angle');
subplot(1,3,2);
plot(w/pi,angle(h),'g');
grid;
xlabel('Normalised Freq');
ylabel('Mag');
title('angle');
subplot(1,3,3);
plot(w/pi,20*log10(h),'r');
grid;
xlabel('N normalised Freq');
ylabel('Log Mag');
title('Log Mag');



Exp 7


clc;
clear all;
close all;
wc=0.2*pi;
N=7;
hd=zeros(1,N);
A=(N-1)/2;
hna=wc/pi;
K=1:1:((N-1)/2);
n=K-1-((N-1)/2);
hd(K)=(sin(wc*n))/(pi*n);
hn(K)=hd(K);
hn=[hn,hna];
a=(N-1)/2;
w=0:pi/16:pi;
Hw1=hna*exp(-1j*w*a);
Hw2=0;
for m=1:1:a;
Hw3=hn(m)*((exp(1j*w*(1-m))+(exp(-1j*w*(1-m+2*a)))));
Hw2=Hw2+Hw3;
end
Hw=Hw2+Hw1;
H_mag=abs(Hw);
plot(w/pi,H_mag,'K');
grid;
title('Mag Resp');
xlabel('Normalised Freq');
ylabel('Mag');


Exp 7

clc;
clear all;
close all;
wc=0.2*pi;
N=7;
hd=zeros(1,N);
A=(N-1)/2;
hna=wc/pi;
K=1:1:((N-1)/2);
n=K-1-((N-1)/2);
hd(K)=(sin(wc*n))/(pi*n);
hn(K)=hd(K);
hn=[hn,hna];
a=(N-1)/2;
w=0:pi/16:pi;
Hw1=hna*exp(-1j*w*a);
Hw2=0;
for m=1:1:a;
Hw3=hn(m)*((exp(1j*w*(1-m))+(exp(-1j*w*(1-m+2*a)))));
Hw2=Hw2+Hw3;
end
Hw=Hw2+Hw1;
H_mag=abs(Hw);
plot(w/pi,H_mag,'K');
grid;
title('Mag Resp');
xlabel('Normalised Freq');
ylabel('Mag');


Exp 8


clc;
clear all;
close all;
x=input('Enter the x(n): ');
h=input('Enter the h(n): ');
n1=length(x);
n2=length(h);
N=n1+n2-1;
y=zeros(1,N);
h1=[h zeros(1,n2-1)];
n3= length(h1);
y= zeros(1,N+n3-n2);
H= fft(h1);
for i= 1:n2:n1
if 1<=(n1+n2-1);
X1=[x(1:1+n3-n2),zeros(1,n3-n2)];
else
X1=[x(1:n1),zeros(1,n3-n3)];
end
X2= fft(X1);
X3= X2.*H;
X4= round(ifft(X3));
if (i==1);
y(i:i+n3-1)=y(i:i+n3-1)+X4(1:n3);
end
end
disp('The o/p sequence y(n): ');
disp(y(1:N));
stem(y(1:N));
title('Overlap add method');
xlabel('n');
ylabel('y(n)');

Exp 9


clc;
close all;
x= input('x= ');
h=input('h= ');
L=input('L= ');
N1=length(x);
M=length(h);
lc=conv(x,h);
x=[x zeros(1,mod(-N1,L)) zeros(1,L)];
N2=length(x);
h= [h zeros(1,L-1)];
H= fft(h ,L+M-1);
s= N2/L;
index= 1:L;
xm=x(index);
x1=[zeros(1,M-1) xm];
X= [];
for stage = 1:s
X1=fft(x1,L+M-1);
Y=X1.*H;
Y=ifft(Y);
index2=M:M+L-1;
Y=Y(index2);
X=[X Y];
index3=(((stage)*L)-M+2):((stage+1)*L)
if index3(L+M-1)<=N2;
x1=x(index3);
end
end
i= 1:N1+M-1;
x=x(i);
similarity=corrcoef(x,lc);
figure
subplot(2,1,1);
stem(lc);
title('Conv using Conv() Func ');
xlabel('n');
ylabel('y(n)');
subplot(2,1,2);
stem(x);
title('Conv using Overlap Save Method ');
xlabel('n');
ylabel('y(n)');

Sub

clc;
clear all;
x = input('Enter the sequence x(n) = ');
h = input('Enter the sequence h(n) = ');
n1 = length(x);
n2 = length(h);
N = n1+n2-1;
h1 = [h zeros(1,N-n1)];
n3 = length(h1);
y = zeros(1,N);
x1 = [zeros(1,n3-n2) x zeros(1,n3)];
H = fft(h1);
for i = 1:n2:N
y1 = x1(i:i+(2*(n3-n2)));
y2 = fft(y1);
y3 = y2.*H;
y4 = round(ifft(y3));
y(i:(i+n3-n2)) = y4(n2:n3);
end
subplot(3,1,1);
stem(x(1:n1));
grid on;
title('Input Sequence x(n)');
xlabel('Time --->');
ylabel('Amplitude --->');
subplot(3,1,2);
stem(h(1:n2));
grid on;
title('Input Sequence h(n)');
xlabel('Time --->');
ylabel('Amplitude --->');
subplot(3,1,3);
disp(' Convolution Using Overlap Save Method = ');
disp(y(1:N));
stem(y(1:N));
grid on;
title(' Convolution Using Overlap Save Method');
xlabel('Time --->');
ylabel('Amplitude --->');
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.