-
Notifications
You must be signed in to change notification settings - Fork 0
/
Transmitter.m
executable file
·52 lines (40 loc) · 1.02 KB
/
Transmitter.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
% SDR Transmitter
%Recive data input
n = 1;
praeambel = round(rand(1,100));
endambel = round(rand(1,100));
s = fopen('datei.txt', 'r');
bitsequence = fread(s, 'ubit1')';
fclose(s);
% bitsequence = repmat([1 0 1],1,50);
data = [praeambel bitsequence endambel];
% Modulate data
%prefix = [1,1,1,1,1,1,1,1];
%postfix = [1,1,1,1,1,1,1,1];
send = fm_2highn_modulate(data, n);
% noise_addition = [rand(1,100) send rand(1,100)];
% plot(noise_addition)
p = audioplayer(send, 22044);
r = audiorecorder(22044, 16, 1);
record(r);
play(p);
pause(20);
stop(r);
receive = getaudiodata(r)';
symbol_sync = Symbolsync(receive, praeambel, n);
plot(symbol_sync)
receive = fm_2highn_demodulate(symbol_sync, n);
frame_sync = framesync(receive, praeambel, endambel);
plot(frame_sync)
subplot(2,1,1)
plot(frame_sync,'ro')
subplot(2,1,2)
plot(bitsequence, 'ro')
%Send data
%send(send) %TODO
% plot(send);
% plot(fmdemodulate(send),'ro');
isequal(frame_sync, bitsequence)
kolar = fopen('empf.txt', 'w');
fwrite(kolar,frame_sync, 'ubit1');
fclose(kolar);