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
Ket [755]
3 years ago
6

Write a function M-file that takes as input two matrices A and B, and as output produces the product by columns of the two matri

x. For instance, if A is 3 × 4 and B is 4 × 5, the product is given by the matrix C = [A*B(:,1), A*B(:,2), A*B(:,3), A*B(:,4), A*B(:,5)] THIS CONTENT IS PROTECTED AND MAY NOT BE SHARED, UPLOADED, SOLD OR DISTRIBUTED 2019 v8 [email protected] School of Mathematical and Statistical Sciences, Arizona State University 8 The function file should work for any dimension of A and B and it should perform a check to see if the dimensions match (Hint: use a for loop to define each column of C). Call the file columnproduct.m. Test your function on a random 5×2 matrix A and a random 2×4 matrix B . Compare the output with A*B. Repeat with 4 × 5 and 5 × 2 matrices and with 4 × 5 and 2 × 5 matrices. Use the command rand to generate the random matrices for testing. Include in your lab report the function M-file and the output obtained by running it.

Engineering
1 answer:
docker41 [41]3 years ago
7 0

Answer:

Here is the code in Matlab for the function.

I have also attached the m file for function as well as the test run of the code  here and screenshot of the result.

Code:

function [ C ] = columnproduct( A, B )

% get the dimesnions of A

sizeA = size(A);

sizeB = size(B);

% check if columns of A are same as rows of B

if(sizeA(2) ~= sizeB(1))

   error('matrix dimensions do not match')

end

% initialize resultant matrix

C = [];

for i = 1:sizeB(2)

   % concatenating product of matrix A with each column of B

   C = [C A*B(:,i)];

end

end

You might be interested in
What is the non-linearity error, as a percentage of full range, produced when a 1K Ω potentiometer has a load of 10KΩ & is a
Darina [25.2K]

Answer:

2.28%

Explanation:

Being at one third of its maximum range a potentiometer should output V0/3.

However if this 1kΩ potentiometer has a 10kΩ load:

(1) I1 = I2 + I3

(2) V0 = I1 * 2/3*Rp + I3 * 1/*Rp

(3) Vp = I2 * Rl

(4) Vp = I3 * 1/3 * Rp

Where

I1: current entering the potentiometer

I2: current going to the load

I3: current going to the other leg of the potentiometer

V0: supply voltage

Vp: output voltage of the potentiometer

Rp: total resistance of the potentiometer

Rl: load resistance

First we determine the intensity of I3 in function of supply power

I3 = 3 * Vp / Rp  = 3 * Vp / 1000 = 0.003*Vp

Then the load current

I2 = Vp / Rl  = Vp / 10000 = 0.0001*Vp

With these we determine I1

I1 = 0.003*Vp + 0.0001*Vp = 0.0031*Vp

Then

V0 = 0.0031 * Vp * 2/3*Rp + 0.003*Vp * 1/3*Rp

V0 = 0.00207 * Vp * Rp + 0.001 * Vp * Rp

V0 = 0.00307 * Vp * 1000

V0 = 3.07 * Vp

Vp = V0 / 3.07

Vp = 0.3257 * V0

Now the percentage error is:

(100 * (0.3333 - 0.3257)) / 0.3333 = 2.28 %

7 0
4 years ago
Sinks must be used for the correct intended purpose to prevent
irakobra [83]

Answer:

... spilling water or getting anything cascading onto the floor

8 0
3 years ago
What pounds per square inch is required by a bubbler system to produce bubbles at a depth of 4 ft 7 in water?
Brut [27]
2.31 ft/psig

1.98 psig would equalize feet of head 4’7”

4.583/2.31 = 1.98. .583 is 7”/12”


So round off to 2.0 psig to get steady stream of bubbles
4 0
3 years ago
Three methods by which the value of the unknown resistance can be determined​
Contact [7]

Answer:

The Meter bridge is the modification of Wheatstone's network used to determine the value of unknown resistance. The meter bridge consists of a thin, uniform, and homogenous conducting wire AC, rectangular wooden board between two thick L shaped metal strips C1 and C2 as shown in the diagram.

5 0
3 years ago
The three sub regions of South America are the Andes Mountains, the Amazon Rainforest, and the Eastern Highlands. The Atacama De
Leto [7]

Answer:

<:

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • What are the Three parts to the energy control system
    8·1 answer
  • The small washer is sliding down the cord OA. When it is at the midpoint, its speed is 28 m/s and its acceleration is 7 m/s 2 .
    13·1 answer
  • 2.7. The term route of entry on an SDS refers to the way a
    13·1 answer
  • ¿Existen formas verbales en singular y en plural?<br>POR FAVOR DIGAMEN EXAMEN TENGO HORITA
    5·1 answer
  • (Metric) Given the front and right views, create an AutoCAD isometric of the object. Save the drawing as lab5c.dwg. Grid size is
    8·1 answer
  • Consider water at 27°C in parallel flow over an isothermal, 1‐m‐long flat plate with a velocity of 2 m/s. a) Plot the variation
    15·1 answer
  • 1. Select the punch that is used to make a mark in metal
    5·1 answer
  • Write a program that prints a one-month calendar. The userspecifies the number of days in the month and the day of the weekon wh
    9·1 answer
  • if you help then I will thank u by sooo much I will give tons of points but the answer has to be right.
    9·2 answers
  • The Role of Fuel Cells in Renewable Energy Solutions
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!