Technical discussion about Matlab and issues related to Digital Signal Processing.
Is this thread worth a thumbs up?
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((k1)*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((k1)*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 __________________________________________________ 
Hi John,
in your code, you change the frequency f once a period. This is much too often. You better increase the sampling rate by x20 or so and create more samples, or in other words, vary the carrier frequency f much slower (linear interpolation or so) Servus Martin  Original Message  From: "John" <> To: <> Sent: Friday, November 15, 2002 1:58 PM Subject: [matlab] FSK modulation > 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((k1)*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 > > > _____________________________________ > /groups.php3 
Hi John, Enjoy it! bit = round(rand(1,10)); % bit stream of random 1's and 0's bitperiod = 1; %bit period fs = 20; %sampling frequency fc = [1 5]; % carrier frequency % create the FSK signal L=length(0:(bitperiod/fs):bitperiod); transmitted = zeros(1,L); for k = 1:length(bit) f = fc(bit(k) + 1); transmitted((k1)*L+1: k*L) = cos(2*pi*f*(0:(bitperiod/fs):bitperiod)); stem(transmitted); end Best regards. digicomm¡¡  20021115 21:58:00 "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((k1)*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 > > >_____________________________________ >/groups.php3 ¡¡ 

Hi digicomm I need help with my QPSK with a set of data bit to extract. I am having great difficulties in modulating and demodulating it. Would highly appreciate it if you have a sample program for me to learn how to do it. Your kind help is greatly appreciated. regards peter  digicomm <> wrote: > Hi John, > > Enjoy it! > > bit = round(rand(1,10)); % bit stream of random 1's > and 0's > bitperiod = 1; %bit period > fs = 20; %sampling frequency > fc = [1 5]; % carrier frequency > % create the FSK signal > L=length(0:(bitperiod/fs):bitperiod); > transmitted = zeros(1,L); > for k = 1:length(bit) > f = fc(bit(k) + 1); > transmitted((k1)*L+1: k*L) = > cos(2*pi*f*(0:(bitperiod/fs):bitperiod)); > stem(transmitted); > end > > Best regards. > > digicomm¡¡ > >  20021115 21:58:00 "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((k1)*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 > > > > > > > > > >_____________________________________ > >/groups.php3 > > > > > > ¡¡ __________________________________________________ 
