Question
answer the following in details..
Q2. Two matrices can be multiplied in number of different ways. Below is given four different ways of multiplying two matrice
1 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

clear all
clc
A=rand(10,5);
B=rand(5,10);
disp('First method');
tic;
A*B
t1=toc;
[m1,n1]=size(A);
[m2,n2]=size(B);
C=[];
tic;
for i=1:m1
for j=1:n2
C(i,j)=0;
for k=1:n1
C(i,j)=C(i,j)+A(i,k)*B(k,j);
end
end
end
t2=toc;
disp('Second method');
disp(C);
fprintf('Time elapsed by first method is %f\n',t1);
fprintf('Time elapsed by second method is %f\n',t2);

MATLAB R2018a EDITOR Search Documentation Log In Find Files Compare Print Run Section New Open Save Advance Run and Find Adva

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Q2. Two matrices can be multiplied in number of different ways. Below is given four different way...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1) A Ramanujam number can be written two different ways as the sum of two cubes—i.e....

    1) A Ramanujam number can be written two different ways as the sum of two cubes—i.e. , there exist distinct a, b, c, and d such that a3 +b3 = c3 +d3. Generate all Ramanujam numbers where a, b, c, d < n. 3-18. What method would you use to look up a word in a dictionary? 3-19. Imagine you have a closet full of shirts. What can you do to organize your shirts for easy retrieval? 3-20. Write a...

  • 5. Dynamic Programming (a) Given a set of four matrices for the following dimensions: We need...

    5. Dynamic Programming (a) Given a set of four matrices for the following dimensions: We need to compute Al* A2 A3 A4 Al=2X3; A2=3X5; A3=5X2: A4=2X4 Find the order in which the matrix pairs should be multiplied to produce the optimum number of operations. Show all your steps (10) (b) For the problems given below, determine whether it is more efficient to use a divide and conquer strategy or a dynamic programming strategy. Give the reasons for your choice (5*3=15)...

  • 2. Partitioned matrices A matrix A is a (2 x 2) block matrix if it is...

    2. Partitioned matrices A matrix A is a (2 x 2) block matrix if it is represented in the form [ A 1 A2 1 A = | A3 A4 where each of the A; are matrices. Note that the matrix A need not be a square matrix; for instance, A might be (7 x 12) with Aj being (3 x 5), A2 being (3 x 7), A3 being (4 x 5), and A4 being (4 x 7). We can...

  • 7. There are two ways of mowing grass, manually and using a machine. The marginal costs...

    7. There are two ways of mowing grass, manually and using a machine. The marginal costs of mowing grass using the different methods are MC1=0.5q, and MC2=20+q2, where q; represents the number of squared feet mowed using each method (method 1 is by machine and method 2 is manually). If you want to mow 1000 squared feet at the lowest possible cost, you should a) mow only by machine, because that way the MC is lower b) mow 320 squared...

  • Rational Number *In Java* A rational number is one that can be expressed as the ratio...

    Rational Number *In Java* A rational number is one that can be expressed as the ratio of two integers, i.e., a number that can be expressed using a fraction whose numerator and denominator are integers. Examples of rational numbers are 1/2, 3/4 and 2/1. Rational numbers are thus no more than the fractions you've been familiar with since grade school. Rational numbers can be negated, inverted, added, subtracted, multiplied, and divided in the usual manner: The inverse, or reciprocal of...

  • Q2. (5 pts) The estimates for two machines, X and Y, are given in different ways...

    Q2. (5 pts) The estimates for two machines, X and Y, are given in different ways in a company as shown below: Machine X in constant-value (today's) dollars while Machine Y in future (then-current) dollars. The company's MARR is equal to the real rate of return of 10% per year, and inflation is 3% per year. Use PW analysis to determine which machine is better. You can use the below factor formula in case the factors table is not available....

  • 1. How many different ways can you have r numbers 1 sum up to a number...

    1. How many different ways can you have r numbers 1 sum up to a number n? These are called compositions of a number n and it is easy to calculate from our understanding of binomial coefficients. So the number of compositions of 4 into 3 parts will be 1+1+2, 1+2+1, and 2+1+1. Note how we think of 1+1+2 and 1+2+1 as different-because in the first case, the first number is 1, second is 1 and third is 2, while...

  • Using your completed table, you can calculate the Spearman correlation in two different ways. One way...

    Using your completed table, you can calculate the Spearman correlation in two different ways. One way is to use the Pearson correlation formula on the ranks of the data. When you do this, you get rs - -0.62. The second way to calculate the Spearman correlation is to use the following formula: Is = 1 - 62D2 n(n2 - 1) In this formula, D represents the difference between ranks for each individual. Using this formula, you get rs - -0.51....

  • Four different types of insecticides are used on strawberry plants. The number of strawberries on each randomly selected plant is given below. Insecticide 1 Insecticide 2 Insecticide 3 Insec...

    Four different types of insecticides are used on strawberry plants. The number of strawberries on each randomly selected plant is given below. Insecticide 1 Insecticide 2 Insecticide 3 Insecticide 4 6 5 6 6 7 7 5 5 6 5 4 4 5 4 3 4 7 5 4 5 6 6 4 3 Does the data suggest that any of these insecticides yield a mean number of strawberries per plant that is different from the others? Use a 5%...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT