AM,FM,PM modulation in matlab

This section of MATLAB source code covers AM,FM,PM modulation in matlab. It mentions the same using modulate matlab function.

Modulate matlab function

%Parameters for signal creation
Fs = 8000; %sampling frequency
t = (0:1000-1)/Fs; %Time vector
s = 4*cos(2*pi*500*t); %modulating signal

sdft = fft(s);
N=length(s);
sdft = sdft(1:N/2+1);
psdy1 = (1/(Fs*N)) * abs(sdft).^2;
psdy1(2:end-1) = 2*psdy1(2:end-1);
freq = 0:Fs/length(s):Fs/2;
figure;plot(freq,10*log10(psdy1)); %FD spectrum of unmodulated signal

y = modulate(s,3e3,Fs,'am',0.1); %modulated signal
ydft = fft(y);
N=length(y);
ydft = ydft(1:N/2+1);
psdy = (1/(Fs*N)) * abs(ydft).^2;
psdy(2:end-1) = 2*psdy(2:end-1);
freq = 0:Fs/length(y):Fs/2;
figure;plot(freq,10*log10(psdy)); %FD spectrum of modulated signal

Output

unmodulated input signal AM modulated signal output

Similar to this FM and PM modulation can also be carried out using modulate function by changing forth argument to 'fm' or 'pm' respectively.


Useful Links to MATLAB codes

Refer following as well as links mentioned on left side panel for useful MATLAB codes.
OFDM Preamble generation  Time off estimation corr  Freq off estimation corr  channel estimation  11a WLAN channel  PN sequence generation  OFDMA Tx Rx  AES DES  carrier aggregation  CCDF  FIR Filter  IIR Filter  Low Pass FIR  Viterbi decoder  CRC8 CRC32 

RF and Wireless tutorials

WLAN  802.11ac  802.11ad  wimax  Zigbee  z-wave  GSM  LTE  UMTS  Bluetooth  UWB  IoT  satellite  Antenna  RADAR