Advertisement
Guest User

decocePicture

a guest
Dec 10th, 2024
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. ar;
  2. load('fnl24.mat');
  3.  
  4. %{
  5. - 64-QAM
  6. - T = 1us THIS IS THE PULSE
  7. - fs = 16MHz
  8. %}
  9.  
  10. nx = 165; ny = 306;
  11. npix = nx * ny;
  12. T = 1e-6;
  13. fs = 16e6;
  14. Ts = 1/fs;
  15. t = 0:Ts:T-Ts;
  16. g = sqrt(1/T) * ones(1, length(t));
  17.  
  18.  
  19. y = conv(v, conj(g), 'same');
  20.  
  21.  
  22. N = length(g);
  23.  
  24. symbols = y(N:N:end)*1/T;
  25.  
  26. bitstream = [];
  27. for symbol = symbols
  28.  
  29. [~, idx] = min(abs(map - symbol));
  30. bits = dec2bin(idx - 1, 6);
  31. bitstream = [bitstream, bits];
  32. %binary_output(n) = strcat(bin_real, bin_imag);
  33. end
  34.  
  35. bitsChannel = npix*8; % # of pixels*8bits per pixel
  36. bitstreamR = bitstream(1:bitsChannel);
  37. bitstreamG = bitstream(bitsChannel + 1:2 * bitsChannel);
  38. bitstreamB = bitstream(2 * bitsChannel + 1:end);
  39.  
  40. %xR = bitPixels(bitstreamR, npix);
  41. pixelBitsR = reshape(bitstreamR, 8, npix)';
  42. xR = bin2dec(pixelBitsR);
  43.  
  44. pixelBitsG = reshape(bitstreamG, 8, npix)';
  45. xG = bin2dec(pixelBitsG);
  46. %xG = bitPixels(bitstreamG, npix);
  47.  
  48. pixelBitsB = reshape(bitstreamB, 8, npix)';
  49. xB = bin2dec(pixelBitsB);
  50. %xB = bitPixels(bitstreamB, npix);
  51.  
  52. XR = reshape(xR, nx, ny);
  53. XG = reshape(xG, nx, ny);
  54. XB = reshape(xB, nx, ny);
  55.  
  56.  
  57.  
  58.  
  59.  
  60. % construct image
  61. X(:, :, 1) = uint8(XR);
  62. X(:, :, 2) = uint8(XG);
  63. X(:, :, 3) = uint8(XB);
  64. imagesc(X);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement