Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168733
Image: ubuntu2004
def s(frequency, num_samples, color='red'): # frequency = fraction of Nyquist f(x) = (sin(x*pi*frequency)) # Source function samples = map(f, range(num_samples)) # Array of samples points = zip(range(num_samples), samples) # array of x,y coords p = plot( f, # Plot the source waveform xmin = 0, xmax = num_samples, figsize = (10,1.5), # 1000 x 150 pixels color='lightblue' ) q = line(points, color=color, marker='.') # Connect the dots of the samples return p+q print "\n\nAn input waveform near the Nyquist frequency is distorted to a warbling one AT the Nyquist frequency." show(s(0.98, 100)) show(s(0.95, 100)) show(s(0.90, 100)) print "\n\nNote that while there are stretched cycles that let the input wave catch up..." show( s(0.98, 30) ) show( s(0.95, 30) + arrow((19,-1),(20,0)) ) show( s(0.90, 30) + arrow((9,-1), (10,0)) + arrow((21,-1),(20,0)) ) print "\n\n... which can also be considered phase distortion ..." show( s(0.95,200) + s(0.98, 200, 'blue')) print "\n\n... the actual output frequency is always the same: 1/2 the sample rate." show( s(0.98,10) + s(0.95, 10) + s(0.90,10) )
An input waveform near the Nyquist frequency is distorted to a warbling one AT the Nyquist frequency.
Note that while there are stretched cycles that let the input wave catch up...
... which can also be considered phase distortion ...
... the actual output frequency is always the same: 1/2 the sample rate.