0% found this document useful (0 votes)
6 views3 pages

Digital Modulation

The document outlines the implementation of three modulation techniques: Amplitude Shift Keying (ASK), Frequency Shift Keying (FSK), and Phase Shift Keying (PSK) using MATLAB code. Each technique includes the generation of a message signal, the carrier signal, and the modulated output, along with plotting the results. The code snippets demonstrate how to visualize the modulated signals for each technique over a specified time vector.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Digital Modulation

The document outlines the implementation of three modulation techniques: Amplitude Shift Keying (ASK), Frequency Shift Keying (FSK), and Phase Shift Keying (PSK) using MATLAB code. Each technique includes the generation of a message signal, the carrier signal, and the modulated output, along with plotting the results. The code snippets demonstrate how to visualize the modulated signals for each technique over a specified time vector.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ASK :

fc = 10; % Carrier frequency (Hz)

fp = 2; % Data/Pulse frequency (Hz)

fs = 100; % Sampling frequency (Hz)

t = 0:1/fs:2; % Time vector (2 seconds)

message = square(2*pi*fp*t);

message(message < 0) = 0; % Convert -1 to 0 (Unipolar)

carrier = sin(2*pi*fc*t); % 3. Create Carrier Signal

% When Message is 1, output is Carrier. When 0, output is 0.

ask_signal = message .* carrier;

subplot(3,1,1); % 5. Plotting the Results

plot(t, message, 'LineWidth', 2);

title('Digital Message (Binary Data)');

ylim([-0.2 1.2]);

subplot(3,1,2);

plot(t, carrier);

title('Carrier Signal');

subplot(3,1,3);

plot(t, ask_signal);

title('ASK Modulated Signal');

xlabel('Time (s)');

OUTPUT:
FSK:

fs = 1000; % Sampling frequency

t = 0:1/fs:1; % Time vector

fc1 = 50; % Frequency for '1'

fc2 = 10; % Frequency for '0'

fp = 5; % Data rate (bits per second)

% Generate Binary Message (0s and 1s)

message = square(2*pi*fp*t) > 0;

% FSK Modulation Logic

% If message is 1, use fc1. If message is 0, use fc2.

fsk_signal = (message).*sin(2*pi*fc1*t) + (~message).*sin(2*pi*fc2*t);

subplot(2,1,1); plot(t, message); title('Message Bits'); ylim([-0.2 1.2]);

subplot(2,1,2); plot(t, fsk_signal); title('FSK Modulated Signal');

OUTPUT:

PSK:

fs = 2000; % High sampling rate for smooth waves

t = 0:1/fs:1; % Time vector

fc = 15; % Carrier frequency

bit_rate = 5; % 5 bits per second

% Using a simple sine-based message to create bits without 'square' function

msg_bits = sign(sin(2*pi*bit_rate*t));

psk_output = msg_bits .* sin(2*pi*fc*t);


h = figure(1); % Create/Select figure window

clf(h); % Clear figure

plot(t, psk_output, 'Color', [0 0.447 0.741], 'LineWidth', 1.5);

title('PSK Modulated Waveform');

xlabel('Time (seconds)');

ylabel('Amplitude');

grid on;

axis([0 1 -1.5 1.5]); % Fix the view area

drawnow; % FORCE MATLAB to render the plot immediately

OUTPUT:

You might also like