Method and apparatus for transmit and receive beamforming using aperture coding