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
Gre4nikov [31]
3 years ago
12

The magic square is an arrangement of numbers in a square grid in such a way that the sum of the numbers in each row, and in eac

h column, and in each diagonal is the same. MATLAB has a built-in function _magic(n) that returns an n times n magic square. In a script file create a (5 times 5) magic square, and then test the properties of the resulting matrix by finding the sum of the elements in each row, in each column and in both diagonals. In each case, use MATLAB's built-in function _sum. (Other functions that can be useful are diag and fliplr.)
Engineering
1 answer:
Yuki888 [10]3 years ago
3 0

Answer:

See the explanation for the answer;

Explanation:

Matlab code is as given below

-------------------------------------------------------------------------------------Start of code

% Program to create a magic square and verify it

clc

M= magic(5)

% To find sum of elements of each row

r1= sum(M(1,:))      % Sum of row 1

r2= sum(M(2,:))      % Sum of row 2

r3= sum(M(3,:))      % Sum of row 3

r4= sum(M(4,:))      % Sum of row 4

r5= sum(M(5,:))      % Sum of row 5

% To find sum of each coloumn

c1= sum(M(:,1))      % Sum of coloumn 1

c2= sum(M(:,2))      % Sum of coloumn 2

c2= sum(M(:,3))      % Sum of coloumn 3

c2= sum(M(:,4))      % Sum of coloumn 4

c2= sum(M(:,5))      % Sum of coloumn 5

% To find sum of diagonal

d1= sum(diag(M))               % Sum of principal diagonal elements

d2= sum(diag(fliplr(M)))      

-------------------------------------------------------------------------------End of code

Following results are obtained when executed.

M =

   17    24     1     8    15

   23     5     7    14    16

    4     6    13    20    22

   10    12    19    21     3

   11    18    25     2     9

r1 =

   65

r2 =

   65

r3 =

   65

r4 =

   65

r5 =

   65

c1 =

   65

c2 =

   65

c2 =

   65

c2 =

   65

c2 =

   65

d1 =

   65

d2 =

   65

You might be interested in
Ann’s Retail, a women’s clothing store, hires female attendants to assist clients in the store’s dressing rooms. Larry, a male,
mojhsa [17]

Answer:

A bona fide occupational qualification defense

Explanation:

Since the store is for women clothing, the retail may prefer to employ only female to assist the customers.  Under a bona fide occupational qualification defense, an employer is allowed to discriminate if a characteristic is a necessity for the performance of the job and for the business. Therefore, the store has a bona fide occupational qualification defense.

3 0
3 years ago
What is the primary function of NCEES?
joja [24]
National Council of Examiners for engineering and surveying a nonprofit organization
7 0
4 years ago
Strain gage is a device that senses the strain of the structure. The property of the strain gage that is used to correlate with
Anni [7]

Answer:

  resistance

Explanation:

A strain gauge changes resistance with applied strain.

8 0
3 years ago
What is closest in meaning to a guild?<br> O rally<br> O framework<br> union<br> O embargo
Degger [83]

Answer:

Union

Explanation:

The correct option is - union

Reason -

Guild is an association of people for mutual aid or the pursuit of a common goal.

Rally is come together in order to provide some support or make a shared effort.

Framework is a basic structure underlying a system, concept, or text.

Union is a club, society, or association formed by people with a common interest or purpose.

An embargo is a government order that restricts commerce with a specified country or the exchange of specific goods.

5 0
3 years ago
Cierto laboratorio está probando una nueva vacuna contra el SARS coV 2 y la 1ra fase incluyesolo 8 voluntarios de tal forma que
madreJ [45]

Answer:

puede que la vacuna no sea segura y se contagien y surga una nueva enfermedad y es lo único que se me ocurre

8 0
2 years ago
Other questions:
  • Water is flowing at a rate of 0.15 ft3/s in a 6 inch diameter pipe. The water then goes through a sudden contraction to a 2 inch
    6·1 answer
  • Knowing that v = –8 m/s when t = 0 and v = 8 m/s when t = 2 s, determine the constant k. (Round the final answer to the nearest
    11·1 answer
  • The water behind Hoover Dam in Nevada is 221 m higher than the Colorado River below it. At what rate must water pass through the
    6·1 answer
  • A heat engine operates between 2 reservoirs at TH and 18oC. The heat engine receives 17,000 kJ/h from the high temperature reser
    10·1 answer
  • Which of the following describes the most direct and attainable way to reduce pollution in the environment?
    15·2 answers
  • What are probiotic bacteria and how did Danino and his team use this type of bacteria to detect liver cancer?
    15·1 answer
  • What does it mean to say that PEER is a data-driven, consumer-centric, and comprehensive system?
    8·2 answers
  • A sheet of steel 1.5 mm thick has nitrogen (N2) atmospheres on both sides at 1200°C and is permitted to achieve steady-state dif
    12·1 answer
  • Question # 3
    11·2 answers
  • Workers who work with what kind of chemicals chemicals may require regular medical checkups on a more frequent basis as a result
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!