0
$\begingroup$

Is it possible to visualize signal in frequency domain for frequencies bigger than $f_s$?

I'd like to get the plot of some example signal like that: enter image description here

I tried to create some signals in Python with different relation of signal frequency and sampling frequency, but I wasn't succeed((

original code:

f_sampling = 2e6
f_sig1 = 700e3

t = np.arange(0,50e-3,0.01e-6)
t_sample = np.arange(0, len(t)*1/f_sampling, 1/f_sampling)

plt.figure(figsize=(15,5))

signal_test = np.cos(2*np.pi*f_sig1*t)
f1 = np.cos(2*np.pi*f_sig1*t_sample)

plt.plot(t, signal_test, label='CW')
plt.plot(t_sample, f1, marker='o', label='digitized')

plt.xlim(0, 50e-6)
plt.legend(loc='lower center')

adding 2 zeros between each sample and FFT of it:

zero_data = []

for i in f1:
    zero_data.append(i)
    zero_data.append(0)
    zero_data.append(0)

zero_data = np.asarray(zero_data)
    
t_zeros = np.linspace(0,len(zero_data)*t_sample[1], len(zero_data))

FFT = np.fft.fft(zero_data*3)
freqs_fft = np.fft.fftfreq(len(zero_data*3), t_zeros[1])

which outputs:

enter image description here

here I didn't get frequencies above $f_s$

And another question - why do we have $f_s$ of signal in frequency domain?

$\endgroup$
6
  • $\begingroup$ Do you know what aliasing is ? $\endgroup$
    – Hilmar
    Dec 27, 2021 at 14:07
  • $\begingroup$ @Hilmar, yes. But I have no idea, how sampling frequency occurs in frequency domain and is it possible to visualize it in Python for example. $\endgroup$
    – Curious
    Dec 27, 2021 at 14:16
  • 1
    $\begingroup$ @Curious if you know what aliasing is, then you already know what the spectrum outside the nyquist bandwidth looks like, so what's the question? $\endgroup$ Dec 27, 2021 at 14:36
  • $\begingroup$ @MarcusMüller, I don't exactly get, why do I see $f_s$ in the spectrum? in the explanation of aliasing this fact (the presence of $f_s$) is assumed as it is without explanation. $\endgroup$
    – Curious
    Dec 27, 2021 at 21:10
  • $\begingroup$ I don't understand the problem. you don't need to know $f_s$ to make a plot relative to $f_s$. Exactly as the plot you show! $\endgroup$ Dec 27, 2021 at 21:28

1 Answer 1

2
$\begingroup$

To visualize the frequencies of discrete time signals beyond the sampling rate, simply insert $M-1$ zeros in between each sample and scale the signal by $M$. This will extend the frequency axis by $M$ where $M$ is any positive integer. What you will see is the periodicity in the frequency domain as given for discrete time signals.

$\endgroup$
18
  • $\begingroup$ Thank you for advice! But in this case the signal will not be the same or what do you mean? $\endgroup$
    – Curious
    Dec 28, 2021 at 14:16
  • $\begingroup$ The signal will be exactly the same in the frequency domain. You will see all the aliasing that results- if you filter out those aliases you will have completed interpolation and then the signal will also be exactly the same in the time domain. $\endgroup$ Dec 28, 2021 at 14:16
  • $\begingroup$ ok, for example, I'll insert 2 zeros at sampling distance between each sample and what do you mean next - scaling the signal by $M$? $\endgroup$
    – Curious
    Dec 28, 2021 at 14:19
  • $\begingroup$ Multiply all samples by 3- in this case you give M=3 $\endgroup$ Dec 28, 2021 at 14:20
  • 1
    $\begingroup$ After you add the zeros, your sampling rate is 3x so your frequency axis as you show should extend to 3MHz— you need to fix that and then it should make sense. $\endgroup$ Dec 28, 2021 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.