DSPRelated.com
Forums

MATLAB CODE FOR ASK - Correction Required

Started by "kapur.soniya18" October 17, 2011
Hello

I got an assignment to generate an ASK using carrier frequency 10MHZ and Digital signal as 110001011

I used below code to generate digital signal which is working as expected

% Plot for Modulating wave 110001011
clc
close all
clear all
t0=0:0.01:0.02;
x0=ones(size(t0));
t1=0.02:0.01:0.05;
x1=zeros(size(t1));
t2=0.05:0.01:0.06;
x2=ones(size(t2));
t3=0.06:0.01:0.07;
x3=zeros(size(t3));
t4=0.07:0.01:0.09;
x4=ones(size(t4));
t=[t0 t1 t2 t3 t4];
x=[x0 x1 x2 x3 x4];
mod = plot(t,x);
ylim([-3, 3])
title('Plot for Modulating Wave 1100001011')
box off
grid

I used below mentioned code for generating Carrier frequency of 10MHZ
% Plot for Carrier wave of Frequency 10MHZ
f000000;
t5 = 0:(pi/10):(11*pi);
y2 = cos(2*pi*f*t5);
cp = plot (t5,y2);
ylim([-2,2]);
title ('Plot for Carrier Frequency of 10MHZ')
box off
grid

And ASK is also not getting generated using above two codes. Please help
% Generate ASK Wave
ASK = cp.*mod;
figure(3)
plot(t,ASK)
title('Amplitude Shift Keying')
ylim([-3,3]);
xlim([0,35]);
box off
grid;
Please advice