How to create a 2D array of weighted+shifted unit impulses?

I’m looking for an efficient way to get a 2D array like this: array([[ 2., -0., -0., 0., -0., -0., 0., 0., -0., 0.], [ 0., -1., -0., 0., -0., -0., 0., 0., -0., 0.], [ 0., -0., -5., 0., -0., -0., 0., 0., -0., 0.], [ 0., -0., -0., 2., -0., -0., 0., 0.,… Read More How to create a 2D array of weighted+shifted unit impulses?

Is there a way to generate multiple sine waves without using loop in Python?

I am trying to generate multiple sine waves, but I want to avoid using loops. Is there a way to do it as in MATLAB? Here is what I tried: fs =250 n = np.linspace(0,2,int(fs*2),endpoint=False) frequencies = [1,3,4,12,70] sines = np.sin(2*np.pi*frequencies*n) When I tried this code I got the following error: ValueError: operands could not… Read More Is there a way to generate multiple sine waves without using loop in Python?