What is the relation between sampling frequency and frequency in a Sine wave function?
50 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Namira
am 26 Mai 2018
Bearbeitet: Walter Roberson
am 13 Mai 2020
I am trying to plot sine wave.
I have this code
Fs = 1000;
t = linspace(0,1-1/Fs,Fs);
f = 15;
a = 4;
y = a*sin(2*pi*f*t);
plot(t,y);
It's not clear to me that what is the relationship between f and Fs? Can anyone help me to understand this? Thanks.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 26 Mai 2018
Bearbeitet: Walter Roberson
am 13 Mai 2020
f is the number of full cycles per second that your sine wave goes through. In this case, f is 15, so the sine wave goes through 15 cycles per second.
Frequency is an inherent property of a sine wave over time, the number of full changes per second. It does not matter how often during one second you check to see what the current value is: it will go through 15 full cycles in one second no matter whether you only ask about the value once or ask about the value thousands of times during one second.
Sampling frequency is the number of times per second that you ask about the current value of the wave. Just like a child asking a parent "Are we there yet?" many times on a car trip does not change the how long the trip is, changing the number of times per second you ask about the wave value does not change the inherent frequency of the wave. (However, unless you ask about the value of the wave at least twice per cycle then you cannot accurately measure what the frequency is.)
But... computers cannot actually store a particular number of samples per second. Computers can only store lists of samples, along with information about how the list of samples is to be interpreted. The more times per second you ask about the value of the wave (sampling frequency), the more items there are in the vector to store. But that does not affect what the values are, which depends upon frequency.
If you know the sampling frequency and you have the list of samples, then you can use analysis such as fft to figure out what the frequency of the wave is... well, or at least of aliased versions of it, if your sampling was not at least twice as fast as the highest frequency to be measured.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spectral Measurements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!