Question: Inputs: - N: An integer - r: A floating - point number - x: A floating - point number - y: A floating - point

Inputs:
- N: An integer
- r: A floating-point number
- x: A floating-point number
- y: A floating-point number
Returns:
A numpy array I of floating point numbers and shape (N, N) such that:
I[i, j]=1 if ||(j, i)-(x, y)||< r
I[i, j]=0 otherwise
In 2 lines of code
Hints:
1) np.meshgrid and np.arange give you X, Y. Play with them. You can also do
it without them, but np.meshgrid and np.arange are easier to understand.
2) Arrays have an astype method

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!