%Matlab code for matrix multiplication
clear all
close all
%Matrix of order N
N=5;
%1st matrix
A=rand(N,N);
fprintf('1st matrix is A=\n')
disp(A)
%2nd matrix
B=rand(N,N);
fprintf('2nd Matrix is B=\n')
disp(B)
%Code for matrix multipliction
CNT=0;
for i=1:N
for j=1:N
sum=0;
for k=1:N
sum=sum+A(i,k)*B(k,j);
end
C(i,j)=sum;
end
end
fprintf('The matrix C=A*B= \n')
disp(C)
fprintf('\n\tTotal number of operation count is
%d\n',2*N*N*N);
fprintf('\tAmong which %d are sum operations and %d are
multiplications.\n',N*N*N,N*N*N)
fprintf('\tFor multiplication operation order matters.\n')
%%%%%%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%%%%
2. Suppose we want to multiply two N-by-N matrices, C-A B, by following the componentwise formula に1 (a) What are the operation counts? (b) In floating-point arithmetic, for which of these operation...
1. Floating point arithmetic. The standard formula for solving ax² +bx+c=0 is -b±/b² – 4ac 2a = Fx However, if b² > closest to zero. Why is this, and how can you avoid this problem? Jac| this can give inaccurate results, at least for the root
Write a MATLAB program that loads two matrices A and B from the files hw41matA.txt andhw41matB.txt and multiplies them together to obtain matrix C such that the element C(i,j) ofmatrix C is given by: C(i, j) = ∑A(i, k) ∗ B(k, j) where n = number of columns in A = number of rows in B. Display the matrix C in defaultMATLAB format. You cannot use the MATLAB matrix multiply or other inbuilt MATLAB functions forarithmetic operations. You must implement it....
Write a c++ program: Many mathematical problems require the addition, subtraction, and multiplication of two matrices. Write an ADT Matrix. You may use the following class definition: const int MAX_ROWS = 10; const int MAX_COLS = 10; class MatrixType { public: MatrixType(); void MakeEmpty(); void SetSize(int rowsSize, int colSize); void StoreItem(int item, int row, int col); void Add(MatrixType otherOperand, MatrixType& result); void Sub(MatrixType otherOperand, MatrixType& result); void Mult(MatrixType otherOperand, MatrixType& result); void Print(ofstream& outfile); bool AddSubCompatible(MatrixType otherOperand); bool MultCompatible(MatrixType otherOperand);...
(1 point) Suppose that we have 5 matrices A a 3 x 2 matrix, B a 2 x 3 matrix, C a 4 x 4 matrix, D a 3 x 2 matrix, and Ea 4 x 4 matrix. Which of the following matrix operations are defined? A. A+D B. C+E C. 3C - 6D D. 4E-6D E. 4D + A F. 3A G. C+E+D H. 4B L. A + B
\ Can anyone explain a and b how they got this answer. what formula they use P-8.2 For each ofthe following 10-point DF「s, determine a formula the l0-point IDFT Use MATLAB to check your work numerically. 1に0 (a) Xa[k] = 0 k = 1, 2, . . . ,9 (b) Xolk-1 for k = 0, 1,2, ,9 (c)Xc[k] =10 k = 0,1,2, 4, 5, 6, 8, 9 (d) Xalk]cos(2mk/5) for k 0,1,2,...,9 k=3, 7 I (a) Substituting into the inverse...
Suppose we want to estimate a parameter θ of a certain distribution and we have the following independent point estimates N(0+0.1,0.01) N(0, 0.04) B2 ~ a) What are the mean square errors for these point estimates? (4pts) b) Find a point estimate with mean square error less than or equal to 0.01. (2pts) c) Only use ël and Ộ2, find the unbiased estimator with the smallest variance possible. What is that estimator? What is the smallest variance? (6pts) Suppose we...
Instructions Write a C++ program that performs the following: Accept a list of floating point values on a single line (separated by spaces). This is vector A. The user may enter as many values as they desire. Accept a second list of floating point values on a single line (separated by spaces). This is vector B. The user may enter as many values as they desire. There is no requirement that the two vectors have the same number of elements....
(a) Suppose we want to solve the linear vector-matrix equation Ax b for the vector x. Show that the Gauss elimination algorithm may be written bAbm,B where m 1, This process produces a matrix equation of the form Ux = g , in which matrix U is an upper-triangular matrix. Show that the solution vector x may be obtained by a back-substitution algorithm, in the form Jekel (b) Iterative methods for solving Ax-b work by splitting matrix A into two...
Write a C++ program that reads in a text file andwrites the histogram of character counts sorted inalphabetical order to an output file. Eg, if theinput file is “to be or not to be”, then the outputshould be:b **2e **2n *1o ****4r *1t ***3
Write a Python program which implements the following two classical cryptosystem which we covered n class: a) Affine Cipher b) Vigenere Cipher Your program should consist of at least five functions: a) Two functions named encrypt, one for each of the two algorithms which accepts a lowercase alphabetical plaintext string and key as input and outputs a corresponding cipher text string. b) Two functions named decrypt, one for each of the two algorithms which accepts a lowercase alphabetical ciphertext string...