Friday, May 20, 2016

Numpy for Signal and Image Processing

Open jupyter notebook in conda

 %matplotlib inline  #enable matplotlib for interactive plotting,  in a same notebook (inline)

 import matplotlib.pyplot as plt # for plotting

import numpy as np    # for array processing

  1. To plot a Ramp Signal
  
         x=np.linspace(0,3,20)
         y=np.linspace(0,9,20)
          plt.plot(x,y)
          plt.plot(x,y,'o')

 

Cosine Signal Generation:

    time=np.linspace(0,2*np.pi,100)
    cosine=np.cos(time)

    plt.plot(time,cosine)
   
 

1 comment:

  1. Do not try to use math.cos(time) which is python math library. If you do so it will generate an error.

    ReplyDelete