Skip to content

Commit

Permalink
Merge pull request #3 from baptu123/patch-1
Browse files Browse the repository at this point in the history
update the comments.
  • Loading branch information
Saptarshi-prog authored Jun 3, 2020
2 parents 2f746bf + 26497f0 commit 2b5ef10
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions amplitude.m
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
function am = amplitude

Ac = input('Enter the value of carrier amplitude: ');
Ac = input('Enter the value of carrier amplitude: ');
m = input('Enter the value of modulation index: ');
fc = input('Enter the value of carrier frequency: ');
fm = input('Enter the value of message signal frequency: ');

Tfm = 1/fm;
Tfc = 1/fc;
Tfm = 1/fm; % Time-period of message signal.
Tfc = 1/fc; % Time-eriod of carrier signal

t1 = 0:Tfm/999:6*Tfm;
t2 = 0:Tfc/999:6*Tfc;
t2 = 0:Tfc/999:6*Tfc; % while plotting carrier signal so that it is scaled to it's time period

carrier_wave = Ac*sin(2*pi*fc*t2);
carrier_wave = Ac*sin(2*pi*fc*t2); % initializing the carrier wave and plotting it
subplot(3,1,1)
plot(t2, carrier_wave, 'r');
title('carrier signal');

message_wave = (Ac*m)*sin(2*pi*fm*t1);
message_wave = (Ac*m)*sin(2*pi*fm*t1); % initializing the message signal and plotting it.
subplot(3,1,2)
plot(t1, message_wave, 'b');
title('Message Signal');

am = Ac*(1+m.*sin(2*pi*fm*t1)).*sin(2*pi*fc*t1);
am = Ac*(1+m.*sin(2*pi*fm*t1)).*sin(2*pi*fc*t1); %initializing the amplitude modulated wave and plotting it.
subplot(3,1,3)
plot(t1, am, 'g');
title('Amplitude Modulated Wave');
grid on;
grid on; % turning the grid on so that it the values can be found out easily.

end

0 comments on commit 2b5ef10

Please sign in to comment.