0% found this document useful (0 votes)
89 views

Experiment No:1 Sampling and Reconstruction

This document describes an experiment on sampling and reconstruction of signals. The objectives are to sample a continuous time signal to create a discrete time signal, and then reconstruct the original continuous signal from the discrete one. The program samples an input sine wave, displays the first 50 samples, and calculates the data and bit rates. It then reconstructs the original signal for different sampling frequencies, observing how the quality changes when the Nyquist criterion is not met.

Uploaded by

Siddhesh Kudav
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)
89 views

Experiment No:1 Sampling and Reconstruction

This document describes an experiment on sampling and reconstruction of signals. The objectives are to sample a continuous time signal to create a discrete time signal, and then reconstruct the original continuous signal from the discrete one. The program samples an input sine wave, displays the first 50 samples, and calculates the data and bit rates. It then reconstructs the original signal for different sampling frequencies, observing how the quality changes when the Nyquist criterion is not met.

Uploaded by

Siddhesh Kudav
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/ 4

Page no.

Experiment no:1
Sampling and Reconstruction
Aim: To study sampling and reconstruction of signal
Objective: Develop a program to sample a continuous time signal and convert it to Discrete
Time Signal.
Problem Definition:
1. Sample the input signal and display first 50 samples. Calculate data rate and bit rate.
2. Reconstruct the original signal and display the original and reconstructed signals.
3. Vary the sampling frequency and observe the change in the quality of reconstructed
signal
Program:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
double y,f;
int t,fs,fc,fsi;
char ch[10];
fc=3;
clrscr();
initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
outtextxy(2,5,"CONTINUOUS SIGNAL : x(t)=50sin(2*pi*3*t)");
line(0,100,800,100);
for(t=0;!(kbhit());t++)
{
y=50*sin(2*(3.14/180)*fc*t);
putpixel(t,-y+100,15);
delay(1);
}
getche();
printf("\nEnter the sampling frequency");
scanf("%d",&fs);
line(0,215,800,215);
fsi=fs;
f=3.0/fs;
outtextxy(2,155,"DISCRETE SIGNAL : x(n)=50sin(2*pi*");
sprintf(ch,"(3/%d)",fsi);
outtextxy(275,155,ch);
outtextxy(325,155,"*n");
for(t=0;!(kbhit());t++)

Page no.
{
y=50*sin(2*(3.14/180)*f*t);
putpixel(t,-y+215,15);
delay(1);
}
getche();
outtextxy(2,270,"RECONSTRUCTED SIGNAL");
line(0,350,800,350);
if(fs<2*fc)
{
for(t=0;!(kbhit());t++)
{
y=50*sin(2*3.14/180-2*(3.14/180)*f*fs*t);
putpixel(t,-y+350,15);
delay(1);
}
getche();
outtextxy(2,405,"Original signal is not obtained since Niquiste criteria");
outtextxy(2,415,"is not followed");
}
else
{
for(t=0;!(kbhit());t++)
{
y=50*sin(2*(3.14/180)*f*fs*t);
putpixel(t,-y+350,15);
delay(1);
}
getche();
outtextxy(2,405,"Original signal is obtained since Niquiste criteria");
outtextxy(2,415,"is followed");
}
getch();
closegraph();
}

Page no.
Output:

Page no.

You might also like