Shruti01
Member level 3
- Joined
- Apr 14, 2010
- Messages
- 67
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 1,288
- Location
- Mumbai, India
- Activity points
- 1,941
hello...
I have to write a matlab code for fsk transmitter. I have generated a binary data sequence. Converted those bits into frequencies of 10000 hz and 8000 Hz. if input bit=1 ten the signal will b a cosine wave having frequency 10000 Hz and if the input bit=0 ten the signal will b a cosine wave having frequency 8000 Hz. after this wat needs 2 b done 2 generate a fsk modulated signal.. following is my code.
clc;
clear all;
close all;
no_of_bits=10;
no_of_samples=20;
threshold=0.5;
Tb=1; % Bit duration
fc=3/Tb; % Carrier frequency
f1=10000;
f0=8000;
t = linspace(0, 1, no_of_samples);
t1=linspace(0, 1, no_of_samples);
t2=t1/fc;
A=rand(1,no_of_bits) % Generate a random sequence
for i=1:no_of_bits
if (A(i)>=threshold)
A(i)=1;
else
A(i)=0;
end
end
d=A(1:no_of_bits) % Binary sequence
for j = 1:length(d)
if d(j)==1
freq1 = cos(2*pi*f1*t2)
else
freq0 = cos(2*pi*f0*t2)
end
end
I have to write a matlab code for fsk transmitter. I have generated a binary data sequence. Converted those bits into frequencies of 10000 hz and 8000 Hz. if input bit=1 ten the signal will b a cosine wave having frequency 10000 Hz and if the input bit=0 ten the signal will b a cosine wave having frequency 8000 Hz. after this wat needs 2 b done 2 generate a fsk modulated signal.. following is my code.
clc;
clear all;
close all;
no_of_bits=10;
no_of_samples=20;
threshold=0.5;
Tb=1; % Bit duration
fc=3/Tb; % Carrier frequency
f1=10000;
f0=8000;
t = linspace(0, 1, no_of_samples);
t1=linspace(0, 1, no_of_samples);
t2=t1/fc;
A=rand(1,no_of_bits) % Generate a random sequence
for i=1:no_of_bits
if (A(i)>=threshold)
A(i)=1;
else
A(i)=0;
end
end
d=A(1:no_of_bits) % Binary sequence
for j = 1:length(d)
if d(j)==1
freq1 = cos(2*pi*f1*t2)
else
freq0 = cos(2*pi*f0*t2)
end
end