MATLAB Code:-
clc
close all;
clear all;
t=0:0.0001:1;
fm=input('enter the msg frequency');
am=input('enter the msg amplitude');
fc=input('enter carrier signal frequency');
ac=input('enter amplitude of carrier signal');
m=am*cos(2*pi*fm*t);
c=cos(2*pi*fc*t);
x=m.*c;
mod=x+(ac.*c);
%plot
subplot(4,1,1),plot(t,m);
xlabel('time');
ylabel('amplitude');
legend('Message signal m(t)');
title('message');
subplot(4,1,2),plot(t,c);
xlabel('time');
ylabel('amplitude');
legend('Carrier signal c(t)');
title('carrier');
subplot(4,1,3),plot(t,mod);
xlabel('time');
ylabel('amplitude');
legend('Amplitude modulated signal s(t)');
title('mod');
%fm signal
b=(fc-fm)/fm;
modfm=ac.*cos(2*pi*fc.*t + b*sin(2*pi*fm.*t));
subplot(4,1,4)
plot(t,modfm);
xlabel('time---(sec)');
ylabel('amp');
legend('Frequency modulated signal s(t)');
title('FM signal')
Input and Output:
enter the msg frequency10
enter the msg amplitude5
enter carrier signal frequency100
enter amplitude of carrier signal5
Figure:
2 comments
thanks for sharing this script :)
schemas et Montages electroniques
Thanks a lot dear
Post a Comment