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
RUDIKE [14]
3 years ago
10

[Submit on zyLabs] Please write a function with one input, a matrix, and one output, a matrix of the same size. The output matri

x should be the input matrix mirrored on the vertical axis. For instance, theinput:[123456789]Would become: [321654987]And the input:[112221112212]Would become:[221112221121]Note that this functions slightly differently for inputs with odd and even numbers of columns. For an odd number of columns, your centermost column stays the same. For an even number of columns, all columns are moved in the resulting output. You can use the function[yDim, xDim]

Computers and Technology
1 answer:
adoni [48]3 years ago
8 0

Answer:

See explaination for the details.

Explanation:

% Matlab file calculateMirrorMatrix.m

% Matlab function to return a matrix which should be input matrix mirrored

% on the vertical axis

% input is a matrix

% output is a matrix of same size as input matrix

function [mirrorMatrix] = calculateMirrorMatrix(inputMatrix)

mirrorMatrix = zeros(size(inputMatrix)); % create output matrix mirrorMatrix of same size as inputMatrix

fprintf('\n Input Matrix :\n');

disp(inputMatrix); % display the input matrix

[row,col] = size(inputMatrix); % row, col contains number of rows and columns of the inputMatrix

% loop to find the matrix which should be input matrix mirrored

for i = 1:row

mirrorIndex =1;

for j = col:-1:1

mirrorMatrix(i,mirrorIndex)=inputMatrix(i,j);

mirrorIndex=mirrorIndex + 1;

end

end

end

% end of matlab function

Please kindly check attachment for its output.

You might be interested in
What can you do to help create a safe online environment? Check all that apply.
Kobotan [32]

3,4,6 this is the answer

4 0
4 years ago
Read 2 more answers
Write a method equals that could be added to the IntTree class. (On your handout this method is called "equals", but Practice-It
masya89 [10]

Answer:

public boolean equals(Object other)

{

// check correct instance

if (other instanceof IntTree)

{

try

{

IntTree otherTree = (IntTree) other;

return equals(overallRoot, otherTree.overallRoot);

}

// caught exceptions

catch (Exception e)

{

return false;

}

}

return false;

}

public boolean equals(IntTreeNode tree1, IntTreeNode tree2)

{

// if reach ends

if (tree1 == null && tree2 == null)

{

// they are equal

return true;

}

else if (tree1 == null || tree2 == null)

{

// not equal

return false;

}

// check left part

boolean leftPart = equals(tree1.left, tree2.left);

// check current element is same

boolean currentPart = tree1.element.equals(tree2.element);

// check right part

boolean rightPart = equals(tree1.right, tree2.right);

// all are equal

return (leftPart && currentPart && rightPart);

}

Explanation:

6 0
3 years ago
Consider a smart array that automatically expands on demand. (Like the java.util.ArrayList.) It starts with some given initial c
elena-14-01-66 [18.8K]

Answer:

Total unit of work required is 1019 units.

Solution:

As per the question:

Initial capacity = 100

On each expansion 50 is added to the present capacity.

Now,

Work done required in addition  of 1000 items = 1000 unit

No. of times there is a need for the allocation of a new Array is given by:

n = \frac{1000 - 100}{50} = 18

We know that:

On addition of 101th element it expands from 100 to 150

On addition of 151st element it expands from 150 to 200 and so on till

On addition of 951st element it expands from 950 to 1000

Now,

For an array of 100 size - 1 for initial allocation.

Therefore, total work done is  given by:

W = 1000 + \frac{1000 - 100}{50} + 1 = 1019\ units

4 0
4 years ago
Match the different supports with their explanations.
Amanda [17]

Answer:

monopod: a vertical support with a single leg for the camera to attach to

minipod: a foot-long support for the camera to achieve low-angle shots

Side rail: a horizantal moving attachment for the camera to move through

Selfie stick: a long support that holds the camera away from the body

:)

Explanation:

4 0
3 years ago
How can the Column settings be accessed?
Lisa [10]

The answer that best answer this question is A

8 0
4 years ago
Read 2 more answers
Other questions:
  • Lean production systems are sometimes referred to as pull systems because demand from customers activates the production actions
    5·1 answer
  • Write a function shampoo_instructions() with parameter num_cycles. If num_cycles is less than 1, print "Too few.". If more than
    7·1 answer
  • Help please appreciate it
    11·1 answer
  • I need help <br> Match each words with its definition!!!<br> Please helpppppppp
    12·1 answer
  • A potential threat to administrators’ ability to manage the correctional system is
    12·1 answer
  • A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To ac
    14·2 answers
  • NEED FIVE QUESTIONS ANSWERED!!!
    7·1 answer
  • Outlines help you visualize the slides and the points you will include on each slide.
    8·1 answer
  • Q) Look at the code and determine the output
    14·1 answer
  • Write a program that calculates pay for either an hourly paid worker or a salaried worker Hourly paid workers are paid their hou
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!