#Sine and cosine in matlab 2017 series
Later on in this series I plan to come back again to the concept of aliasing and show some examples of how it looks in an image. Like a low-frequency cosine after we sampled it. Because the sampling frequency was too low, a high-frequency cosine looked That's the heart of the "problem" of aliasing. The samples above look like they actually could have come from a 10 Hz cosine signal, instead of a 60 Hz cosine signal. Increasingly like they came from a different, lower-frequency signal. ) ams for discrete time signal sequence (Unit step, Unit written and the. When we drop the sampling frequency too low, the samples start to look Thus the MATLAB progr ramp, Sine, Cosine, Exponential, Unit impulse) using MATLAB function results were plotted. If you'llĪllow a "hand-wavy" explanation here, I'll say that this sampling frequency of 120 Hz is just enough to capture the cosineīut aliasing is worse that "just" losing information. Oscillation? This is the significance of "twice the highest frequency of the signal" value for sampling frequency. See how the samples jump back and forth between 1 and -1? And how they capture only the extremes of each period of the cosine
(And I'll switch to using circle markers to make the samples easier to see.) Now let's drop the sampling frequency down to exactlyġ20 Hz, twice the frequency of the 60 Hz cosine. The samples above are still adequately capturing the shape of the cosine. Samples are clearly capturing the oscillation of the continuous-time cosine. The sampling frequency of 800 Hz is well above 120 Hz, which is twice the frequency of the cosine.
Let's sample with a sampling frequency of 800 Hz. Let's start with a continuous-time cosine signal at 60 Hz. I thought about drawing some new frequency-domain diagrams showing overlapping triangles like you'd see in Oppenheim and Schafer, but then I thought it might be better to just continue the sampled cosine example from last time. Significance of "twice the highest frequency"? There are two key pieces of the question to address: What is the nature of the "problem," and what is the I know I promised to introduce the discrete Fourier transform next, but I'd like to change my mind and try to answer Dave's Experiment with commands 'cos', 'tan', 'cot'. The sinusoid is plotted for values of x between 0 and 2 p the step between consecutive values of x is 0.1. The sampling rate of your discrete signal is not at least twice the highest existing frequency [in the continuous-time Type at the Matlab prompt: You will see a sinusoid on the graphics window. wanted to know how this related to what he learned about aliasing: that aliasing is a "problem that occurs when I said that if you sample a continuous-time cosine at a sampling frequency, then you can't distinguish between a cosine with frequency and a cosine with frequency. It isn't always obvious how the different explanations for the same concepts are connected.įor example, in my last Fourier transform post I talked about aliasing. One challenge of teaching Fourier transform concepts is that each concept can be (and is) interpreted and explained in manyĭifferent ways.