Problems regarding signal sampling

In summary: So for that reason you might expect a lower pitch, but the spacing is still too small to hear any decent pitch. If you were to measure the click spacing, you would find that it is exactly the same in both cases. That is because the clicks are a result of the sampling rate, not the frequency. So if you do a 4096 FFT, your clicks will be at 2048, 6144, etc. That is why you hear the same pitch.
  • #1
haha1234
109
0

Homework Statement


I have created four signals in Matlab and we need to play the sound of these signals.
The four signals I've created are:

n=[0:8191];
w0=2*pi*2000;
T=1/8192;
t=[0,1];
t=n*T;
x=sin(w0*t);
sound(x,1/T);
-----------------

n=[0:8192];
w0=2*pi*2000;
T=1/8192;
t=[0,1];
t=n*T;
x=sin(w0*t);
[X,f]=ctfs(x,T);
sound(X,1/T);
-------------------------
n=[0:8191];
w0=2*pi*3000;
T=1/8192;
t=[0,1];
t=n*T;
x=sin(w0*t);
sound(x,1/T);
--------------------
n=[0:8192];
w0=2*pi*3000;
T=1/8192;
t=[0,1];
t=n*T;
x=sin(w0*t);
stem(x(1:50));
---------------------
The function ctfs is defined as:

function [X,f] = ctfts(x,T)
% CTFTS calculates the continuous
-
time Fourier transform (CTFT) of a
% periodic signal x(t) which is reconstructed from the samples in the
% vector x using ideal band
limited interpolation. The vector x
% contains samples of x(t) over an integer number of periods, and T
% contains the sampling period.
%
% The vector X contains the area of the impulses at the frequency
% values stored in the vector f.
%
% This function m
akes use of the relationship between the CTFT
% of x(t) and the DTFT of its samples x[n], as well as the
% relationship between the DTFT of the samples x[n] and the DTFS of x[n].
N = length(x);
X = fftshift(fft(x,N))*(2*pi/N);
f = linspace(-1,1-2/N,N)/(2*T);


The w0 of the first two signals is 2*pi*2000 and the w0 of the last two signals is 2*pi*2000.
Why the pitch of the signals increase as the w0 increase when we do not apply the ctfs function, while the pitches are the same when we apply the function?

Homework Equations


3. The Attempt at a Solution [/B]
I tried to find out the reason why by deriving the Fourier series of the sampled signals.
And the results are shown below:

For w0=2*π*2000:
The Fourier series is:
x[n]=sin(2π*2000*n/8192)
=sin(125πn/256)
=1/2ej125πn/256-1/2e-j125πn/256

For w0=2*π*3000:
The Fourier series is:
x[n]=sin(2π*3000*n/8192)
=sin(375πn/512)
=1/2ej375πn/512-1/2e-j375πn/512

From these results, I found the magnitude spectra and I discovered that the distance between each magnitude components(?) getting longer as the w0 increase. Therefore, I think the pitch should be decrease with the increase of w0.

On the other hand, I have no idea why the pitch does not change when we add the function ctfs?

Thanks!
 
Physics news on Phys.org
  • #2
haha1234 said:
The w0 of the first two signals is 2*pi*2000 and the w0 of the last two signals is 2*pi*2000.
You meant 2*pi*3000 for the last two.
Also:
* your function name is ctfts, but you call it ctfs
* sound requires a real array, you are providing a complex array - use abs().
* The code you provided for creating the 3000 Fourier sound doesn't do that.
haha1234 said:
Why the pitch of the signals increase as the w0 increase when we do not apply the ctfs function, while the pitches are the same when we apply the function?

From these results, I found the magnitude spectra and I discovered that the distance between each magnitude components(?) getting longer as the w0 increase. Therefore, I think the pitch should be decrease with the increase of w0.

On the other hand, I have no idea why the pitch does not change when we add the function ctfs?

Thanks!
Any variation of the Fourier Transform should put you in the frequency domain. I haven't looked at your ctfs function in detail, but I accept that it qualifies as a "variation of the Fourier Transform".
When taking the FT of a signal, a change in frequency (from 2000 to 3000) should result in a shift in the FT. So, for example, in the 2*pi*2000 case, you would get a peak at 2000 and perhaps some harmonics. And with 2*pi*3000, you would get a peak at 3000 and some harmonics. If those harmonics were strong, you might notice a pitch change, but with sine waves, they are probably inaudible. So would you should get is a click - the same click in both cases, just slightly more delayed for the 3000Hz case.
 
  • #3
So with 2*pi*2000, you get clicks at 4096 +/- 2000. With 2*pi*3000, you get clicks at 4096 +/- 3000.
In both cases you get 2 clicks, but the clicks are spaced further apart with 3000.
 

1. What is signal sampling and why is it important?

Signal sampling is the process of converting a continuous signal into a discrete signal by taking samples at regular intervals. It is important because it allows us to analyze and process signals using digital systems, and is essential for data acquisition and processing in various fields such as telecommunications, audio and video processing, and medical imaging.

2. What is the Nyquist-Shannon sampling theorem?

The Nyquist-Shannon sampling theorem states that in order to accurately reconstruct a signal, it must be sampled at a rate of at least twice the highest frequency component of the signal. This is also known as the Nyquist rate. Sampling at a rate lower than the Nyquist rate can lead to aliasing, where high frequency components are misrepresented as lower frequency components.

3. What is the difference between analog and digital signals?

An analog signal is a continuous signal that varies in time and amplitude, while a digital signal is a discrete signal that only takes on specific values at specific intervals. Analog signals are represented by a continuous waveform, while digital signals are represented by a series of discrete values. In order for an analog signal to be processed by a digital system, it must be converted into a digital signal through sampling.

4. How does the sampling rate affect the quality of a digital signal?

The sampling rate, or the rate at which samples are taken, can affect the quality of a digital signal in several ways. If the sampling rate is too low, it can lead to aliasing and distort the signal. On the other hand, a higher sampling rate can result in a more accurate representation of the original signal, but it also requires more storage and processing power.

5. What are some common methods for improving signal sampling?

One common method for improving signal sampling is oversampling, which involves taking more samples than the Nyquist rate. This can help reduce the effects of aliasing and improve the accuracy of the reconstructed signal. Another method is using anti-aliasing filters, which remove high frequency components before sampling to prevent aliasing. Additionally, using a higher resolution analog-to-digital converter can also improve the quality of the digital signal.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
6
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
14
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Electrical Engineering
Replies
4
Views
839
  • Engineering and Comp Sci Homework Help
Replies
12
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
34
Views
11K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
991
Back
Top