# FSK modulation

Started by November 15, 2002
 I'tyring to generate a bit stream that will be modulated using an FSK signal. So far what I have is when I plotted the graph what I have is not an FSK signal but a bit stream.... bit = round(rand(1,10)); % bit stream of random 1's and 0's bitperiod = 0.1; %bit period fs = 11025; %sampling frequency fc = [1000 5000]; % carrier frequency % create the FSK signal transmitted = zeros(1,bit); for k = 1:length(bit) f = fc(bit(k) + 1); transmitted(floor((k-1)*bitperiod*fs)+1: floor(k*bitperiod*fs)) = cos(2*pi*f*(0:(bitperiod/fs):bitperiod)); % here's the trouble % I'm having. plot(transmitted) end Thanks guys for your help
 The code you gave gives an assignment error. Is that your problem. You have to rework the indices for transmitted and time values for cos(x). They both should be of same size which in your case is 1102. After that I got something which looks like a cosine wave. Navan --- John <> wrote:> I'tyring to generate a bit stream that will be > modulated using an FSK > signal. So far what I have is when I plotted the > graph what I have > is not an FSK signal but a bit stream.... > > bit = round(rand(1,10)); % bit stream of random 1's > and 0's > bitperiod = 0.1; %bit period > fs = 11025; %sampling frequency > fc = [1000 5000]; % carrier frequency > % create the FSK signal > transmitted = zeros(1,bit); > for k = 1:length(bit) > f = fc(bit(k) + 1); > transmitted(floor((k-1)*bitperiod*fs)+1: > floor(k*bitperiod*fs)) = > cos(2*pi*f*(0:(bitperiod/fs):bitperiod)); % here's > the trouble > % I'm > having. > plot(transmitted) > end > > Thanks guys for your help __________________________________________________