# Single-Sideband Amplitude Modulation

This example shows how to use the Hilbert transform to carry out single-sideband (SSB) amplitude modulation (AM) of a signal. Single-sideband AM signals have less bandwidth than normal AM signals.

Generate 512 samples of a simulated broadband signal using the `sinc` function. Specify a bandwidth of $\pi /4$ rad/sample.

```N = 512; n = 0:N-1; bw = 1/4; x = sinc((n-N/2)*bw);```

Add white Gaussian noise such that the signal-to-noise ratio is 20 dB. Reset the random number generator for reproducible results. Use the `periodogram` function to estimate the power spectral density (PSD) of the signal.

```rng default SNR = 20; noise = randn(size(x))*std(x)/db2mag(SNR); x = x + noise; periodogram(x)``` Amplitude modulate the signal using a cosine of carrier frequency ${\omega }_{c}=\pi /2$. Multiply by $\sqrt{2}$ so that the power of the modulated signal equals the power of the original signal. Estimate the PSD.

```wc = pi/2; x1 = x.*cos(wc*n)*sqrt(2); periodogram(x1) legend('Modulated')``` SSB amplitude modulation reduces the bandwidth of the signal by half. To carry out SSB amplitude modulation, you must first compute the Hilbert transform of the signal. Then, amplitude modulate the signal using a sine with the same carrier frequency, ${\omega }_{c}$, as before, and add it to the previous signal. Design a Hilbert transformer using the `designfilt` function. Specify a filter order of 64 and a transition width of 0.1. Filter the signal.

```Hhilbert = designfilt('hilbertfir','FilterOrder',64, ... 'TransitionWidth',0.1); xh = filter(Hhilbert,x);```

Use the `grpdelay` function to determine the delay, `gd`, introduced by the filter. Compensate for the delay by discarding the first `gd` points of the filtered signal and padding with zeros at the end. Amplitude modulate the result and add it to the original. Compare the PSDs.

```gd = mean(grpdelay(Hhilbert)); xh = xh(gd+1:end); eh = zeros(size(x)); eh(1:length(xh)) = xh; x2 = eh.*sin(wc*n)*sqrt(2); y = x1+x2; periodogram([x1;y]') legend('Modulated','SSB')``` Downconvert the signal and estimate the PSD.

```ym = y.*cos(wc*n)*sqrt(2); periodogram(ym) legend('Downconverted')``` Lowpass filter the modulated signal to recover the original. Specify a 64th-order FIR lowpass filter with a cutoff frequency of $\pi /2$. Compensate for the delay introduced by the filter.

```d = designfilt('lowpassfir','FilterOrder',64, ... 'CutoffFrequency',0.5); dem = filter(d,ym); gd = mean(grpdelay(d)); dem = dem(gd+1:end); dm = zeros(size(x)); dm(1:length(dem)) = dem;```

Estimate the PSD of the filtered signal and compare it to that of the original.

```periodogram([x;dm]') legend('Original','Recovered')``` Use the `snr` function to compare the signal-to-noise ratios of the two signals. Plot the two signals in the time domain.

`snrOrig = snr(x,noise)`
```snrOrig = 20.0259 ```
`snrRecv = snr(dm,noise)`
```snrRecv = 20.1373 ```
```plot(n,[x;dm]') legend('Original','Recovered') axis tight``` References

Buck, John R., Michael M. Daniel, and Andrew C. Singer. Computer Explorations in Signals and Systems Using MATLAB. 2nd Edition. Upper Saddle River, NJ: Prentice Hall, 2002.
{"ft_lang_label":"__label__en","ft_lang_prob":0.7112799,"math_prob":0.9972456,"size":3015,"snap":"2021-04-2021-17","text_gpt3_token_len":822,"char_repetition_ratio":0.13782796,"word_repetition_ratio":0.013667426,"special_character_ratio":0.26533997,"punctuation_ratio":0.17723577,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99909616,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"im_url_duplicate_count":[null,1,null,1,null,1,null,1,null,1,null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-01-27T01:51:24Z\",\"WARC-Record-ID\":\"<urn:uuid:dca503de-979d-4720-bd39-452b5ffd4644>\",\"Content-Length\":\"73127\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:a6f6435c-d930-4086-91f4-0325a9e81490>\",\"WARC-Concurrent-To\":\"<urn:uuid:59307c7e-85c8-4d69-81a3-992a12d7e9c9>\",\"WARC-IP-Address\":\"184.28.136.58\",\"WARC-Target-URI\":\"https://jp.mathworks.com/help/signal/ug/single-sideband-amplitude-modulation.html?lang=en\",\"WARC-Payload-Digest\":\"sha1:CYBNUNN6RTP35YVQ5XGJX7A4R2WFJQ3X\",\"WARC-Block-Digest\":\"sha1:7KAJXW7ZVHUOUKC5BCLR6OSHQ7OFIAZ4\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-04/CC-MAIN-2021-04_segments_1610704804187.81_warc_CC-MAIN-20210126233034-20210127023034-00710.warc.gz\"}"}