Natural Sampling by Pulse-train | Scigyan

Natural Sampling by Pulse-train

Matlab program for Natural Sampling by Pulse-train.

Matlab code

clc; close all; clear all;
fm=input('Enter the frequency of Message signal = ');
fc=input('Enter the frequency of Carrier signal = ');
A=input('Enter the amplitude of Message signal = ');
t = 0:0.0001:1/fm;

Sm=A*sin(2*pi*fm*t); % Message signal
tc=1/fc; % Time period of Carrier signal
d=0:tc:length(t);
width=tc/2; % High time of one Pulse
Sp=pulstran(t,d,'rectpuls',width); % Carrier signal (Pulse-train)
Sn=Sp.*Sm; % Natural Sampled Signal

subplot(3,1,1);
plot(t,Sm);
xlabel('Time-->');
ylabel('Amplitude-->');
title('Message Signal');

subplot(3,1,2);
plot(t,Sp);
xlabel('Time-->');
ylabel('Amplitude-->');
title('Carrier Signal (Pulse-train)');
axis([0 1/fm -A-1 A+1]);

subplot(3,1,3);
plot(t,Sn);
xlabel('Time-->');
ylabel('Amplitude-->');
title('Natural Sampled Signal');

Command window

Enter the frequency of Message signal = 2.
Enter the frequency of Carrier signal = 100.
Enter the amplitude of Message signal = 1.

Figure window

Natural-Sampling-by-Pulse-train
No comments:
Post a Comment

Related Posts Plugin for WordPress, Blogger...