# Upsampling — Imaging Artifacts

This example shows how to upsample a signal and how upsampling can result in images. Upsampling a signal contracts the spectrum. For example, upsampling a signal by 2 results in a contraction of the spectrum by a factor of 2. Because the spectrum of a discrete-time signal is $2\pi$-periodic, contraction can cause replicas of the spectrum normally outside of the baseband to appear inside the interval $\left[-\pi ,\pi \right]$.

Create a discrete-time signal whose baseband spectral support is $\left[-\pi ,\pi \right]$. Plot the magnitude spectrum.

f = [0 0.250 0.500 0.7500 1]; a = [1.0000 0.5000 0 0 0]; nf = 512; b = fir2(nf-1,f,a); Hx = fftshift(freqz(b,1,nf,'whole')); omega = -pi:2*pi/nf:pi-2*pi/nf; plot(omega/pi,abs(Hx)) grid xlabel('\times\pi rad/sample') ylabel('Magnitude')

Upsample the signal by 2. Plot the spectrum of the upsampled signal. The contraction of the spectrum has drawn subsequent periods of the spectrum into the interval $\left[-\pi ,\pi \right]$.

y = upsample(b,2); Hy = fftshift(freqz(y,1,nf,'whole')); hold on plot(omega/pi,abs(Hy)) hold off legend('Original','Upsampled') text(0.65*[-1 1],0.45*[1 1],["\leftarrow Imaging" "Imaging \rightarrow"], ... 'HorizontalAlignment','center')
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 4, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7037538886070251, "perplexity": 3550.3255119838577}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-49/segments/1637964363006.60/warc/CC-MAIN-20211204185021-20211204215021-00071.warc.gz"}