0% found this document useful (0 votes)
3 views3 pages

1716 Exp7

The document is a C program that performs linear convolution of two input sequences, h(n) and x(n). It prompts the user to enter the lengths and values of both sequences, pads them with zeros to match the required length, and then computes the convolution output. Finally, it prints the resulting convolution values to the console.

Uploaded by

utsav.mishra25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

1716 Exp7

The document is a C program that performs linear convolution of two input sequences, h(n) and x(n). It prompts the user to enter the lengths and values of both sequences, pads them with zeros to match the required length, and then computes the convolution output. Finally, it prints the resulting convolution values to the console.

Uploaded by

utsav.mishra25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

/*

* main.c
*/
#include <stdio.h>

int main()
{
int x[15] = {0};
int h[15] = {0};
int y[15] = {0};
int N,L,K,i,j = 0;
printf("Enter the length of h(n): ");
scanf("%d",&N);
printf("Enter the length of x(n): ");
scanf("%d",&L);
K=N+L-1;
printf("Enter the values of h(n)");
for(i=0;i<N;i++)
{
scanf("%d",&h[i]);
}
printf("Enter the values of x(n)");
for(j=0;j<L;j++)
{
scanf("%d",&x[j]);
}

// padding of zeros to make lengths of h(n) and x(n) equal to K = N+M-1

for(i=N;i<=K;i++)
{
h[i]=0;
}
for(i=L;i<=K;i++)
{
x[i]=0;
}

// linear convolution of h(n) and x(n)

for(i=0;i<K;i++)
{
y[i]=0;
for(j=0;j<=i;j++)
{
y[i]=y[i]+((h[j])*(x[i-j]));
}
}

printf("\nLinear convolution output is:");

for(i=0;i<=K;i++)

{
printf("\n y(%d) = %d",i,y[i]);
}

while(1)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy