1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
german
3 years ago
9

Write a code that makes a 2D square array with 20×20 elements. Fill the array with random numbers initially. Then, "draw" a squa

re in the array by adding a value of 4 to those array elements, and plot it with imshow. The square should be centered and have side lengths of 10 .
Computers and Technology
1 answer:
NemiM [27]3 years ago
4 0

Answer:

Answer explained below. Python language used

Explanation:

The size of the square is of size 10. So assuming zero indexing,

vertical side1 (column Index = 5): row index from 5 to 14

vertical side1 (column Index = 14): row index from 5 to 14

horizontal side1 (row Index = 5): column index from 5 to 14

horizontal side2 (row Index = 14): column index from 5 to 14

Note:

while indexing, data_new[a:b,c] denotes,

row index: a to b-1

column index: c

Similarly data_new[a,b:c] denotes,

row index: a

column index: b to c-1

<u>Code: </u>

import matplotlib.pyplot as plt

import numpy as np

size_1 = 20

size_2 = 20

data_new = np.random.random((size_1,size_2))

data_new[5:15,5] = 4

data_new[5:15,14] = 4

data_new[5,5:15] = 4

data_new[14,5:15] = 4

fig = plt.figure(figsize=(10,10))

plt.imshow(data_new)

plt.colorbar()

plt.show()

You might be interested in
Which action will help you protect data in your computer in case of an earthquake?
Len [333]

Answer:

Explanation: 13

8 0
3 years ago
Read 2 more answers
Match the job roles with their appropriate qualifications
UNO [17]
Knowledge...- software QA engineer
Master’s...- business analyst
course...- network and computer admin
training...- multimedia artist
3 0
3 years ago
Computer C’s performance is 4 times as fast as the performance of computer B, which runs a given application in 28 seconds. How
slamgirl [31]

Answer:

112

Explanation:

Since computer C's performance is 4 times faster, naturally I'd multiply 28 by 4.

6 0
3 years ago
One way to save time and get to the colleges that you are most interested in at a college fair is to
son4ous [18]

Answer:

Identify the location of the college stand in advance.

Explanation:

One way to save time and get to the colleges that you are most interested in at a college fair is to find out in advance the information about the fair, the colleges that are participating and from that pick the more interesting ones and identify the location of their stands. Like that when you arrive to the fair you can go directly to them and find them easily which will save you a lot of time as you won't be walking around the whole place to find them.

8 0
2 years ago
Read 2 more answers
How can an Excel table be added to a Word document? Check all that apply.
densk [106]

Answer:

A and B

Explanation:

3 0
3 years ago
Other questions:
  • At the dsl local carrier's office, the __________ demultiplexes the data streams and converts them into digital data.
    10·1 answer
  • What is a directory server?
    5·1 answer
  • A fast food chain that wants to inform consumers about its latest dollar menu item will most likely use ___ to do so. ____ may i
    7·2 answers
  • What does it mean when system ui has stopped?
    9·1 answer
  • Yahoo and Google are examples of __________ used to perform Internet research.
    14·2 answers
  • Bobbi owns a protein shake company, which has been trading for 3 years. Her products are stocked in a number of gyms, but the co
    11·1 answer
  • If your microwave oven is a computer, define its Operating System and User Interface.
    12·1 answer
  • Where do charts get the data series names?
    14·1 answer
  • Pls awnser I will mark brainliest as soon as possible
    13·2 answers
  • 1. Write a statement that opens the file Customers.dat as a random access file for both reading and writing.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!