Wednesday, June 20, 2012

Amplitude Modulation using matlab

Amplitude Modulation Matlab Program
fs=400;
fo=5;
fc=25;
num_periods=40;
samp_period=(fs/fo);
totalsamp=samp_period*num_periods;
n=[0:totalsamp-1];
t=(n/fs);
m=sin(2*pi*fo*t);
N=totalsamp;
M=abs(fft(m,N))/totalsamp;
M=fftshift(M);
F=[-N/2:(N/2)-1];
Ac=1;
Ka=0;
DCoffset=1;
s=Ac*(DCoffset+Ka*m).*cos(2*pi*fc*t);
S=abs(fft(s,N))/totalsamp;
S=fftshift(S);
close all;
F2=figure;
subplot(3,1,1);
plot(t,s,t,(DCoffset+Ka*m),'--'),grid;
Maxtime=5*samp_period/fs;
xlabel('time(ms)');
subplot(3,1,2);
plot(F,M)
xlabel('frequency(khz)');
subplot(3,1,3);
plot(F,s)



 You may like Digital Modulation Techniques now you are at analog modulation
0. Frequency Modulation                     
1. Amplitude shift keying                     
2. Frequency shift keying                     
3. Phase shift keying                             
4. Hybrid Shift Keying                          

Friday, June 15, 2012

Frequency Modulation Using Matlab

clear;
close all;

%PARAMETERS
fc=200;            % carrier frequency in hertz
t0=0.15;            %time range in seconds
Df=50;            %frequency deviation constant in hertz/volt

ts=0.0005;                  % sampling interval
t=[0:ts:t0];                % time vector

%MESSAGE SIGNAL
m=[2*ones(1,t0/(3*ts)),-3*ones(1,t0/(3*ts)),ones(1,t0/(3*ts)+1)];
figure(1)
hold on
plot(m,'black');
title('Message signal');
xlabel('time');
ylabel('signal value');
set(1,'PaperPositionMode','auto');
%FM SIGNAL
fi=fc+Df*m;
s=cos(2*pi*fi.*t);
plot(s,'red');
title('FM signal');
xlabel('time');
ylabel('signal value');
hleg=legend('message signal','FM signal')



You may like Digital Modulation Techniques now you are at analog modulation
0. Amplitude Modulation         AM
1. Amplitude shift keying        ASK
2. Frequency shift keying        FSK
3. Phase shift keying                PSK

DC motor control with Pulse Width Modulation Part 1

DC Motor intro DC motor is a device which converts electrical energy into kinetic energy. It converts the DC power into movement. The typica...