### Tags: audio, code, demod, fsk, matlab, mod, ne1, programming, signal

# Code for FSK mod and Demod of an Audio signal

On Programmer » Matlab

2,789 words with 2 Comments; publish: Sat, 26 Apr 2008 21:34:00 GMT; (20093.75, « »)

please could ne1 help me

*http://matlab.questionfor.info/q_matlab_8258.html*

All Comments

Leave a comment...

- 2 Comments
- In article <ef549d0.0.matlab.questionfor.info.webcrossing.raydaftYaTP>,
Matlab novice <arian_dame.matlab.questionfor.info.yahoo.co.in> wrote:

>please could ne1 help me

Which was a follow up to the earlier question,

>Can any one help me with the code of FSk modulation and demodulation

>of an audio signal. I need it urgently.

Answer: if you describe -specific- problems with your attempt at

the FSK code, we may be able to assist you with it. However, people

are unlikely to supply completed code for what sounds like a class

assignment.

--

All is vanity. -- Ecclesiastes

#1; Sat, 26 Apr 2008 21:35:00 GMT

- In article <ef549d0.0.matlab.questionfor.info.webcrossing.raydaftYaTP>,
- The following code may be useful to you:
%FSK Modulation

bit = round(rand(1,10)); % bit stream of random 1's and 0's

bitperiod = 0.01; %bit period

fs = 15000; %sampling frequency

fc = [3000 5000]; % carrier frequency

% create the FSK signal

L=length(0:(bitperiod/1500):bitperiod);

transmitted = zeros(1,L);

for k = 1:length(bit)

f = fc(bit(k) + 1);

transmitted((k-1)*L+1: k*L) =

cos(2*pi*f*(0:(bitperiod/1500):bitperiod));

%transmitted()=transmitted()+2*randn(siz

e(0.01));

%stem(transmitted);%fsk verified

%y = filter(b,a,transmitted);

end

plot(transmitted);

%FSK Demodulation

demod_output=zeros(1,10);

A=zeros(L,1);

%B=zeros(L,1);

Decision=0;

%Logic_0=0;

A=transpose(cos(2*pi*5000*(0:(bitperiod/1500):bitperiod))-cos(2*pi*300

0*(0:(bitperiod/1500):bitperiod)));

%B=transpose(cos(2*pi*5000*(0:(bitperiod

/1500):bitperiod)));

for x = 1:length(bit)

Decision= transmitted((x-1)*L+1: x*L)*A;

%Logic_0= transmitted((x-1)*L+1: x*L)*A;

if Decision>0

demod_output(x)=1;

else

demod_output(x)=0;

end

stem(demod_output);

end

I have one problem, if anyone couls solce it...

I want to implement the FSK demodulator of the above code in FPGA.

But how to implement the generation of mark 5kHz and space 3kHz

frequenies in the FPGA(corresponding to the expression

cos(2*pi*5000*(0:(bitperiod/1500):bitperiod))-cos(2*pi*3000*(0:(bitper

iod/1500):bitperiod))))'

Krishan.

Walter Roberson wrote:

>

> In article <ef549d0.0.matlab.questionfor.info.webcrossing.raydaftYaTP>,

> Matlab novice <arian_dame.matlab.questionfor.info.yahoo.co.in> wrote:

> Which was a follow up to the earlier question,

>

> demodulation

>

> Answer: if you describe -specific- problems with your attempt at

> the FSK code, we may be able to assist you with it. However, people

> are unlikely to supply completed code for what sounds like a class

> assignment.

> --

> All is vanity. --

> Ecclesiastes

>

#2; Sat, 26 Apr 2008 21:36:00 GMT

- The following code may be useful to you: