Experiment No.1: %implementing Unit Impulse Function
Experiment No.1: %implementing Unit Impulse Function
1
%Implementing Unit Impulse Function
x = (-4:1:4);
y = [0 0 0 0 1 0 0 0 0];
subplot(2,1,1);
stem(x,y);
xlabel('X-axis');
ylabel('Y-axis');
subplot(2,1,2);
plot(x,y);
xlabel('X-axis');
ylabel('Y-axis');
subplot(2,1,1);
stem(x,y);
xlabel('X-axis');
ylabel('Y-axis');
subplot(2,1,2);
plot(x,y);
xlabel('X-axis');
ylabel('Y-axis');
x = (-4:1:4);
y = [0 0 0 0 (0:1:4)];
subplot(2,1,1);
stem(x,y);
xlabel('X-axis');
ylabel('Y-axis');
subplot(2,1,2);
plot(x,y);
xlabel('X-axis');
ylabel('Y-axis');
%Implementing functions
x = (-4:1:4);
stem(x,y);
xlabel('X-axis');
ylabel('Y-axis');
subplot(3,2,2);
plot(x,y);
xlabel('X-axis');
ylabel('Y-axis');
subplot(3,2,4);
plot(x,y1);
xlabel('X-axis');
ylabel('Y-axis');
y2 = [0 0 0 0 (0:1:4)];
subplot(3,2,5);
stem(x,y2);
xlabel('X-axis');
ylabel('Y-axis');
subplot(3,2,6);
plot(x,y2);
xlabel('X-axis');
ylabel('Y-axis');
EXPERIMENT No.2
%Implementing Convolution Sum For Linear Time Invariant
System
x = [1 2 3];
h = [1 2 1];
#include<stdio.h>
#include<conio.h>
int main()
{
clrscr();
int x[10],h[10],c[10][10];
int i,j,k,m,n;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
c[i][j]=x[j]*h[i];
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
printf(" %d ",c[i][j]);
printf("\n\t");
}
for(k=0;k<m;k++)
{
for(j=0;j<n;j++)
y[k+j]=y[k+j]+c[k][j];
for(i=0;i<terms;i++)
printf("%d ",y[i]);
getch();
return 0 ;