Marco
Marco

Reputation: 81

How can i make a matrix filled with a sequence for the rows and columns

I want to create a matrix with an complex part and a real part. The values from the colums should go from [-2.0 -> 1.0] with 300 steps The values from the rows should go from [-1.5 -> 1.5] with steps of 300, this is also the complex part.

I can make a matrix of 301 X 301 and fill this with zeros. But then i need the fill in the values. I don't know how i to do that. I was thinking using a double for loop but don't know ,how to implement this.

this is what i would like to get

[ array([[-2.00+1.5j, -1.99+1.5j, ..., 1.00+1.5j ], [ ..., ..., ..., ... ] [-2.00-1.5j ,-1.99-1.5j, ..., 1.00-1.5j ]]) ]

Upvotes: 0

Views: 75

Answers (1)

Paul Panzer
Paul Panzer

Reputation: 53029

You can make an open grid and sum it:

sum(np.ogrid[1.5j:-1.5j:301j,-2:1:301j])

Upvotes: 1

Related Questions