How to Write a matlab code to plot the amplitude modulated signal in time domain.

60 ビュー (過去 30 日間)
How to Write a matlab code to plot the amplitude modulated signal in time domain. Modulating signal = cos2π(300t) Carrier signal = cos2π(5000t)

採用された回答

Scott MacKenzie
Scott MacKenzie 2021 年 6 月 27 日
編集済み: Scott MacKenzie 2021 年 6 月 27 日
Here's one way to do this. I'm showing two graphs, one with 5 Hz amplitude modulation, one with 5 kHz amplitude modulation. I've also passed the modulated signal into the sound function, so you can hear the result as well. At 5 Hz, the effect in music is known as tremolo.
duration = 3; % seconds
samplingRate = 8192; % per second
samplingInterval = 1 / samplingRate;
t = 1:samplingInterval:duration;
y1 = cos(2*pi*300*t); % signal
y2 = cos(2*pi*5*t); % modulating signal (frequency = 5 Hz, adjust as desired)
y2 = rescale(y2,0.25,1); % modulation amplitude min/max factor
y = y1 .* y2; % create amplitude-modulated signal
% plot about 1 second of the signal (to show amplitude modulation)
plot(y(1:9000))
set(gca,'ylim', [-1.2, 1.2]);
% play it
sound(y, samplingRate); % NOTE: sRate not needed if 8192 (default)
5 Hz modulation:
5 kHz modulation:
  2 件のコメント
Yash Yadav
Yash Yadav 2021 年 6 月 27 日
Nice understandable
Md. Sakib-Ul-Islam
Md. Sakib-Ul-Islam 2022 年 3 月 4 日
what if i want to see the frequency spectrum of this modulated wave? can i get a code for that?

サインインしてコメントする。

その他の回答 (2 件)

MD Rasel Basunia
MD Rasel Basunia 2022 年 4 月 8 日
%% taking input of different parameter
Ac=1;%carrier Amplitude
Mu=0.9 % modulation index (let)
fm=300 % message signal frequency
fc=5000 % carrier frequency
fs=100*fm % sampling frequency with oversampling factor 100
%% setting proper time intervals
%t = [0:1e-8:1e-2];
t=[0:1/fs:1e-2];
%% compute the AM signal
x_am_1 = Ac*(1+Mu*cos(2*pi*fm*t)).*cos(2*pi*fc*t);%Am equation
%% compute envelop
x_envelop_1 = abs(Ac*(1+Mu*cos(2*pi*fm*t)));% equation of envelop
%% Graph of Am and its envelop
subplot(211)
plot(t,x_am_1,t,x_envelop_1,'r','linewidth',1.5);grid on;
xlabel('Time(sec)');ylabel('Amplitude');legend('AM signal','Envelop');
title('Single sided envelop of AM with modulation index Mu=0.9');
%% Double side envelop
subplot(212)
plot(t,x_am_1,'k',t,x_envelop_1,'r',t,-x_envelop_1,'b','linewidth',1.5);grid on;
xlabel(' time ');ylabel('Amplitude')
legend('AM signal','Double sided envelop');
title('Double sided envelop of AM with Mu = 0.9');
% you can change modulation index in the above code.
% output:

safuan khatimi
safuan khatimi 2023 年 1 月 7 日
how to find modulation index?

カテゴリ

Help Center および File ExchangeModulation についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by