How can i generate PPM,PAM,PWM modulation and demodulation .

23 Ansichten (letzte 30 Tage)
sandhya
sandhya am 18 Aug. 2011
Kommentiert: Walter Roberson am 5 Okt. 2024
I have tried the function pammod also but i couldnt get the output, please help me to generate PAM,PPM,PWM.

Antworten (2)

Aena Verma
Aena Verma am 24 Okt. 2020
% PAM using Ideal Sampling
clc;
close all;
clear all;
a = input('Enter the amplitude = ');
f = input('Enter the frequency = ');
t = 0:0.02:2;
x1 = 1; %generation of an impulse signal
x2 = a*sin(2*pi*f*t); %generation of sine wave
y = x1.*x2; %modulation step
subpl20ot(3,1,1); %for impulse signal plot
stem(x1);
title('Impulse Signal');
xlabel('Time');
ylabel('Amplitude ');
subplot(3,1,2) %for sine wave plot
plot(t,x2);
title('Sine Wave');
xlabel('Time ');
ylabel('Amplitude ');
subplot(3,1,3) %for PAM wave plot
stem(t,y);
title('PAM Wave');
xlabel('Time');
ylabel('Amplitude');
% PAM using Natural Sampling
clc;
clear all;
close all;
fc= 100
fm= fc/10
fs= 100*fc
t=0:1/fs:4/fm;
Msg_sgl= cos(2*pi*fm*t);
Carr_sgl= 0.5*square(2*pi*fc*t)+0.5
Mod_sgl= Msg_sgl.*Carr_sgl;
tt= [];
for i=1:length(Mod_sgl);
if Mod_sgl(i)==0;
tt=[tt,Mod_sgl(i)];
else
tt=[tt,Mod_sgl(i)+2];
end
end
figure(1)
subplot(4,1,1);
plot(t,Msg_sgl);
title('Message Signal');
xlabel('Time Period');
ylabel('Amplitude');
subplot(4,1,2);
plot(t,Carr_sgl);
title('Carrier Signal')
xlabel('Time Period');
ylabel('Amplitude');
subplot(4,1,3);
plot(t,Mod_sgl);
title('PAM Modulated signal')
xlabel('Time Period');
ylabel('Amplitude');
% subplot(4,1,4);
% plot(t,tt);
% title('PAM')
% xlabel('Time Period');
% ylabel('Amplitude');
% PWM Signal
clc;
close all;
clear all;
t=0:0.0001:1;
s=sawtooth(2*pi*10*t+pi);
m=0.75*sin(2*pi*1*t);
n=length(s);
for i=1:n
if (m(i)>=s(i))
pwm(i)=1;
elseif (m(i)<=s(i))
pwm(i)=0;
end
end
plot(t,pwm,'g',t,m,'r',t,s,'b');
ylabel('Amplitude');
axis([0 1 -1.5 1.5]);
xlabel('Time index');
title('PWM Wave');
grid on;
% PPM Signal
clc;
clear all;
close all;
fc=1000;
fs=10000;
fm=200;
t=0:1/fs:((2/fm)-(1/fs));
X= 0.5*cos(2*pi*fm*t)+0.5;
Y= modulate(X,fc,fs,'PPM');
subplot(2,2,1);
plot(X);
title('Msg Signal');
subplot(2,2,2);
plot(Y);
axis([0 500 -0.2 1.2]);
title('PPM');
  3 Kommentare
manuel suarez
manuel suarez am 15 Apr. 2022
Hello good morning, I have a question, what modifications should I make to the code for a sine wave message signal of amplitude (4+15) Vpk-pk and with a frequency of 497 KHz. please help me, thank you.
Vaishak B
Vaishak B am 26 Aug. 2022
t=0:1/fs:4/fm;
Could you please explain this instruction?

Melden Sie sich an, um zu kommentieren.


Enkh
Enkh am 5 Okt. 2024
Bearbeitet: Walter Roberson am 5 Okt. 2024
% PAM using Ideal Sampling
clc;
close all;
clear all;
a = input('Enter the amplitude = ');
Error using input
Support for user input is required, which is not available on this platform.
f = input('Enter the frequency = ');
t = 0:0.02:2;
x1 = 1; %generation of an impulse signal
x2 = a*sin(2*pi*f*t); %generation of sine wave
y = x1.*x2; %modulation step
subpl20ot(3,1,1); %for impulse signal plot
stem(x1);
title('Impulse Signal');
xlabel('Time');
ylabel('Amplitude ');
subplot(3,1,2) %for sine wave plot
plot(t,x2);
title('Sine Wave');
xlabel('Time ');
ylabel('Amplitude ');
subplot(3,1,3) %for PAM wave plot
stem(t,y);
title('PAM Wave');
xlabel('Time');
ylabel('Amplitude');
% PAM using Natural Sampling
clc;
clear all;
close all;
fc= 100
fm= fc/10
fs= 100*fc
t=0:1/fs:4/fm;
Msg_sgl= cos(2*pi*fm*t);
Carr_sgl= 0.5*square(2*pi*fc*t)+0.5
Mod_sgl= Msg_sgl.*Carr_sgl;
tt= [];
for i=1:length(Mod_sgl);
if Mod_sgl(i)==0;
tt=[tt,Mod_sgl(i)];
else
tt=[tt,Mod_sgl(i)+2];
end
end
figure(1)
subplot(4,1,1);
plot(t,Msg_sgl);
title('Message Signal');
xlabel('Time Period');
ylabel('Amplitude');
subplot(4,1,2);
plot(t,Carr_sgl);
title('Carrier Signal')
xlabel('Time Period');
ylabel('Amplitude');
subplot(4,1,3);
plot(t,Mod_sgl);
title('PAM Modulated signal')
xlabel('Time Period');
ylabel('Amplitude');
% subplot(4,1,4);
% plot(t,tt);
% title('PAM')
% xlabel('Time Period');
% ylabel('Amplitude');
% PWM Signal
clc;
close all;
clear all;
t=0:0.0001:1;
s=sawtooth(2*pi*10*t+pi);
m=0.75*sin(2*pi*1*t);
n=length(s);
for i=1:n
if (m(i)>=s(i))
pwm(i)=1;
elseif (m(i)<=s(i))
pwm(i)=0;
end
end
plot(t,pwm,'g',t,m,'r',t,s,'b');
ylabel('Amplitude');
axis([0 1 -1.5 1.5]);
xlabel('Time index');
title('PWM Wave');
grid on;
% PPM Signal
clc;
clear all;
close all;
fc=1000;
fs=10000;
fm=200;
t=0:1/fs:((2/fm)-(1/fs));
X= 0.5*cos(2*pi*fm*t)+0.5;
Y= modulate(X,fc,fs,'PPM');
subplot(2,2,1);
plot(X);
title('Msg Signal');
subplot(2,2,2);
plot(Y);
axis([0 500 -0.2 1.2]);
title('PPM');

Communitys

Weitere Antworten in  Power Electronics Control

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by