AMPLITUDE SHIFT KEYING MODULATION AND DEMODULATION USING MATLAB

AMPLITUDE SHIFT KEYING MODULATION AND DEMODULATION USING MATLAB

CODE:

clc;
clear all;
close all;
x=input(‘Enter the input digital sequence’);
N=length(x);
t=0.01:0.01:N;
c=2*sin(2*pi*t);
for i=1:1:N
m((i-1)*100+1:i*100)=x(i);
end
y=c.*m;
subplot(3,1,1);
plot(t,m);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘digital input signal’);
subplot(3,1,2);
plot(t,c);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘sinusoidal signal’);
subplot(3,1,3);
plot(t,y);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘PSK modulated signal’);
r=randn(1,length(y));
k=y+r;
figure;
plot(t,k);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘noise added PSK signal’);
t1=0:0.01:.99;
r1=sin(2*pi*t1);
r2=fliplr(r1);
l=length(k)+length(r2)-1;
d1=fft(k,l);
d2=fft(r2,l);
d=d1.*d2;
p=ifft(d,l);
figure;
plot(p);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘correlated signal’);
for j=1:length(x)
q(j)=p(100*j);
if q(j)>15
m1(j)=1;
else
m1(j)=0;
end
end
for i=1:1:N
s((i-1)*100+1:i*100)=m1(i);
end
figure;
plot(s);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘demodulated signal’);

Amplitude-shift keying (ASK) is a form of modulation that represents digital data as variations in the amplitude of a carrier wave.

Any din scheme uses a finite number of distinct signals to represent digital data. ASK uses a finite number of amplitudes, each assigned a unique pattern of binary digits. Usually, each amplitude encodes an equal number of bits. Each pattern of bits forms the symbol that is represented by the particular amplitude. The demodulator, which is designed specifically for the symbol-set used by the modulator, determines the amplitude of the received signal and maps it back to the symbol it represents, thus recovering the original data. Frequency and phase of the carrier are kept constant.

Like AM, ASK is also linear and sensitive to atmospheric noise, distortions, propagation conditions on different routes in PSTN, etc. Both ASK modulation and demodulation processes are relatively inexpensive. The ASK technique is also commonly used to transmit digital data over optical fiber. For LED transmitters, binary 1 is represented by a short pulse of light and binary 0 by the absence of light. Laser transmitters normally have a fixed “bias” current that causes the device to emit a low light level. This low level represents binary 0, while a higher-amplitude lightwave represents binary 1.

The simplest and most common form of ASK operates as a switch, using the presence of a carrier wave to indicate a binary one and its absence to indicate a binary zero. This type of modulation is called on-off keying, and is used at radio frequencies to transmit Morse code (referred to as continuous wave operation),

More sophisticated encoding schemes have been developed which represent data in groups using additional amplitude levels. For instance, a four-level encoding scheme can represent two bits with each shift in amplitude; an eight-level scheme can represent three bits; and so on. These forms of amplitude-shift keying require a high signal-to-noise ratio for their recovery, as by their nature much of the signal is transmitted at reduced power.

REFERENCE:

http://en.wikipedia.org/wiki/Amplitude-shift_keying

psk modulation and demodulation using matlab

psk modulation and demodulation using matlab

Phase-shift keying (PSK) is a digital modulation scheme that conveys data by changing, or modulating, the phase of a reference signal (the carrier wave).

Any digital modulation scheme uses a finite number of distinct signals to represent digital data. PSK uses a finite number of phases, each assigned a unique pattern of binary digits. Usually, each phase encodes an equal number of bits. Each pattern of bits forms the symbol that is represented by the particular phase. The demodulator, which is designed specifically for the symbol-set used by the modulator, determines the phase of the received signal and maps it back to the symbol it represents, thus recovering the original data. This requires the receiver to be able to compare the phase of the received signal to a reference signal — such a system is termed coherent (and referred to as CPSK).

Alternatively, instead of operating with respect to a constant reference wave, the broadcast can operate with respect to itself. Changes in phase of a single broadcast waveform can be considered the significant items. In this system, the demodulator determines the changes in the phase of the received signal rather than the phase (relative to a reference wave) itself. Since this scheme depends on the difference between successive phases, it is termed differential phase-shift keying (DPSK). DPSK can be significantly simpler to implement than ordinary PSK since there is no need for the demodulator to have a copy of the reference signal to determine the exact phase of the received signal (it is a non-coherent scheme). In exchange, it produces more erroneous demodulation.

CODE:

clc;
clear all;
close all;
x=input(‘Enter the input binary sequence’);
N=length(x);
x(x==0)=-1;
t=0.01:0.01:N;
c=2*sin(2*pi*t);
for i=1:1:N
m((i-1)*100+1:i*100)=x(i);
end
y=c.*m;
subplot(3,1,1);
plot(t,m);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘digital input signal’);
subplot(3,1,2);
plot(t,c);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘sinusoidal signal’);
subplot(3,1,3);
plot(t,y);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘PSK modulated signal’);
r=randn(1,length(y));
k=y+r;
figure;
plot(t,k);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘noise added PSK signal’);
t1=0:0.01:.99;
r1=sin(2*pi*t1);
r2=fliplr(r1);
l=length(k)+length(r2)-1;
d1=fft(k,l);
d2=fft(r2,l);
d=d1.*d2;
p=ifft(d,l);
figure;
plot(p);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘correlated signal’);
for j=1:length(x)
q(j)=p(100*j);
if q(j)>0
n(j)=1;
else
n(j)=0;
end
end
figure;
stem(n);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘demodulated signal’);

REFERENCE
http://en.wikipedia.org/wiki/Phase-shift_keying

DELTA MODULATION AND DEMODULATION USING SIMULINK

DELTA MODULATION AND DEMODULATION USING SIMULINK

Delta modulation (DM or Δ-modulation)is an analog-to-digital and digital-to-analog signal conversion technique used for transmission of voice information where quality is not of primary importance. DM is the simplest form of differential pulse-code modulation (DPCM) where the difference between successive samples are encoded into n-bit data streams. In delta modulation, the transmitted data is reduced to a 1-bit data stream. Its main features are:
the analog signal is approximated with a series of segments
each segment of the approximated signal is compared to the original analog wave to determine the increase or decrease in relative amplitude
the decision process for establishing the state of successive bits is determined by this comparison
only the change of information is sent, that is, only an increase or decrease of the signal amplitude from the previous sample is sent whereas a no-change condition causes the modulated signal to remain at the same 0 or 1 state of the previous sample.

PHASE MODULATION

PHASE MODULATION

PHASE MODULATION

 

 

This same as that of fm but only the change is we use pmmod instead of fmmod.

CODE:

close all;
clear all;
t=0:10*10^(-6):0.001;
fm1=10^(3);
x=2*sin(2*pi*fm1*t);
fc=20*10^(6);
fs=100*10^(6);
dph=pi/2;
ini_phase=0;
y=pmmod(x,fc,fs,dph,ini_phase); %phase modulation
subplot(1,2,1);
plot(x);
title(‘message signal’);
subplot(1,2,2);
plot(y);
title(‘phase modulation’);

FREQUENCY MODULATION

FREQUENCY MODULATION

n telecommunications and signal processing, frequency modulation (FM) conveys information over a carrier wave by varying its instantaneous frequency. This contrasts with amplitude modulation, in which the amplitude of the carrier is varied while its frequency remains constant. In analog applications, the difference between the instantaneous and the base frequency of the carrier is directly proportional to the instantaneous value of the input-signal amplitude. Digital data can be sent by shifting the carrier’s frequency among a range of settings, a technique known as frequency-shift keying (FSK). FSK is widely used in data and fax modems, and can be used to send Morse code. Radio teletype also uses FSK. Frequency modulation is also used in telemetry, radar, seismic prospecting and newborn EEG seizure monitoring. Frequency modulation is known as phase modulation when the carrier phase modulation is the time integral of the FM signal. FM is widely used for broadcasting music and speech, two-way radio systems, magnetic tape-recording systems and some video-transmission systems. In radio systems, frequency modulation with sufficient bandwidth provides an advantage in canceling naturally-occurring noise.

IT is mainly calculated based upon a command i.e

y=fmmod(x,fc,fs,dph,ini_phase); %frequency modulation

CODE:

close all;
clear all;
t=0:10*10^(-6):0.001;
fm1=10^(3);
x=2*sin(2*pi*fm1*t);
fc=20*10^(6);
fs=100*10^(6);
dph=8*10^(6);
ini_phase=0;
y=fmmod(x,fc,fs,dph,ini_phase); %frequency modulation
subplot(1,2,1);
plot(x);
title(‘message signal’);
subplot(1,2,2);
plot(y);
title(‘frequency modulation’);

PULSE CODE MODULATION

PULSE CODE MODULATION

CODE:
clc;
clear all;
close all;
t=0:0.01:5;
x=2*sinc(2*pi*t);
figure;
plot(x);
hold all;
e=uencode(x,3);
d=udecode(e,3);
plot(d);
c=compand(x,255,2,’mu/compressor’);
e1=uencode(c,3);
d1=udecode(e1,3);
ex=compand(d1,255,2,’mu/expander’);
plot(ex);
xlabel(‘time’);
ylabel(‘magnitude’);
title(‘pulse code modulation of sinc function’);

Pulse-code modulation (PCM) is a method used to digitally represent sampled analog signals. It is the standard form of digital audio in computers, Compact Discs, digital telephony and other digital audio applications. In a PCM stream, the magnitude of the analog signal is sampled regularly at uniform intervals, and each sample is quantized to the nearest value within a range of digital steps.

PCM streams have two basic properties that determine their fidelity to the original analog signal: the sampling rate, the number of times per second that samples are taken; and the bit depth, which determines the number of possible digital values that each sample can take.

LINEAR CONVOLUTION

LINEAR CONVOLUTION

CODE:

clc;
clear all;
close all;
x1=input(‘Enter the 1st Sequence=’);
x2=input(‘Enter the 2nd Sequence=’);
L=length(x1);
M=length(x2);
if (L>M);
x2=[x2 zeros(1,L-M)];
else
x1=[x1 zeros(1,M-L)];
end
N=L+M-1;
X1=fft(x1,N);
X2=fft(x2,N);
Y=X1.*X2;
Z=ifft(Y,N);
subplot(3,1,1);
stem(x1);
grid on;
xlabel(‘n—>’);
ylabel(‘Amplitude’);
title(‘1st Sequence’);
subplot(3,1,2);
stem(x2);
grid on;
xlabel(‘n—>’);
ylabel(‘Amplitude’);
title(‘2nd Sequence’);
subplot(3,1,3);
stem(Z);
grid on;
xlabel(‘n—>’);
ylabel(‘Amplitude’);
title(‘Linear Convolution’);