Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. clc; clear all; close all;
  2. Obraz = imread('4.1.08.tiff');
  3.  
  4. figure(1);image(Obraz)
  5. y = 256*256*3;
  6. Pom = reshape(Obraz, 1, y);
  7. Wektor = de2bi(Pom);
  8.  
  9. Y = double(Wektor);
  10. hx = modem.qammod('M', 16, 'SymbolOrder', 'binary', 'InputType', 'bit');
  11. Y = modulate(hx, Y);
  12. Y1024 = reshape(Y,1024,384);
  13. Yifft = ifft(Y1024); % odwrotna transofmrata fouriera
  14. Y_przedrostki = [Yifft(1015:1024,:);Yifft]; % dolozenie ostatnich 10 elementow na poczatek kazdej grupy elementow
  15. b = [1, 0.5, -0.7]; % wspolczynniki filtru
  16. Y = reshape(Y_przedrostki, numel(Y_przedrostki),1); % w filtracji potrzebny jest wektor kolumnowy
  17. Yf = filter(b,1,Y); % Yf - sygnal odfiltrowany
  18. snr = 20;
  19. Yf = awgn(Yf, snr); % dodawanie szumu (przechodzenie sygnalu przez kanal)
  20. Y1034 = reshape(Yf,1034,numel(Yf)/1034);
  21. Y1024 = Y1034(11:1034,:); % usuniecie 10 elementow z poczatku (przedrostkow)
  22. Y = fft(Y1024);
  23. Popr = fft(b,1024);
  24. b_odwrotne = 1./Popr;
  25. Popraw = zeros(384,1024);
  26. for i=1:384
  27. Popraw(i,:) = b_odwrotne(:);
  28. end
  29. YpoPoprawce = Y.*Popraw';
  30. h = modem.qamdemod('M', 16, 'PHASEOFFSET', 0, 'SYMBOLORDER', 'BINARY','OUTPUTTYPE', 'Bit', 'DECISIONTYPE', 'HARD DECISION');
  31. Y = demodulate(h, YpoPoprawce);
  32. Obraz = reshape(uint8(Y),196608,8);
  33. Obraz = bi2de(Obraz);
  34. Obraz = reshape(Obraz,256,256,3);
  35. image(Obraz);
  36. pause;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement