• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest May 26th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. %Question 1 - BPSK
2. x = 0:9;
3. message='SnirTomer';
4. S0=ones(1,10);
5. S1=-S0;
6.
7. subplot(2,2,1);
8. stem(x, S0);
9. binary_message=dec2bin(message);
10. binary_message=[binary_message(1,:) binary_message(2,:) binary_message(3,:) binary_message(4,:) binary_message(5,:) binary_message(6,:) binary_message(7,:) binary_message(8,:) binary_message(9,:)];
11. N = length(S0);
12. before_noise = zeros(1,10);
13. for i=1:N
14.
15.    if binary_message(i)-48 == 0
16.        before_noise(i) = S0(i);
17.    else
18.        before_noise(i) = S1(i);
19.    end
20. end
21.
22. subplot(2,2,2);
23. stem(x, before_noise);
24.
25. sd=15484; %15484 just for example
26. s=rng(sd);
27.
28. for i=1:N
29.     temp = mod(randn(1,1),1);
30.     rf_signal(i) = before_noise(i) + temp;
31.
32. end
33.
34. subplot(2,2,3);
35. stem(x, rf_signal);
36.
37.
38. positive = zeros(1, 10);
39. negative = zeros(1, 10);
40.
41. for i=1:N
42.
43.     temp = rf_signal(i);
44.     if temp > 0
45.         positive(i) = temp;
46.     else
47.         negative(i) = temp;
48.     end
49. end
50.
51.
52. subplot(2,2,4);
53. stem(x, positive, 'green')
54. hold on
55. stem(x, negative, 'red')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?