Write a code that comapres between the columns of two matrices. if there is a column shared between both matrices, it gets deleted from both of them. finally the code should print the two new matrices after the modification. [MATLAB]
NOTE:
SIZES
Matrix 1 : 81 x 126
Matrix 2 : 81 x 94
`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
clc
clear all
close all
A=input('Enter 1st matrix: ');
B=input('Enter second matrix: ');
[m1,n1]=size(A);
[m2,n2]=size(B);
C=[];
D=[];
for i=1:n1
for j=1:n2
if(A(:,i)==B(:,j))
if(sum(C==i)~=1)
C=[C i];
end
if(sum(D==j)~=1)
D=[D j];
end
end
end
end
A(:,C)=[];
B(:,D)=[];
disp('The modified matrices are: ');
disp('A is');
disp(A);
disp('B is');
disp(B);
Kindly revert for any queries
Thanks.
Write a code that comapres between the columns of two matrices. if there is a column...
Write in C code
What to do Write a function with the following signature: float* matrix multiplication(float* left, float* right, int rows, int shared, int columns); The first two arguments are two pointers to the beginning of two matrices with the dimensions (rows,shared) and (shared, columns) correspondingly. The remaining arguments specify these dimensions. The return value will return a pointer to the very beginning of the result matrix. That said, you need to provide the space for the result matrix...
Write your own matlab code to perform matrix multiplication. Recall that to multiply two matrices, the inner dimensions must be the same. Write this as a function with input arguments the matrices to be multiplied and output argument the resultant matrix, use "assert" statement(s) to check that the input arguments are valid and print an error message if they are not. Test with A=[1,2,3;4,5,6] and B=[7,8;9,10;11,12] showing results for: (a) A*B, (b) B*A, and (c) A*A.
Write a code that gets the quiz grades of a class. A matrix with n rows and m columns where n stands for number of students and m is the number of quizzes. Let’s call the matrix A. Then, your code drops the lowest grade of each student and remove it from the matrix. Also, it finds the average grade for the quizzes for each student and add a new column to the end the matrix. in matlab please
MUST BE PROCEDURAL CODE. Write a program in C++ that reads two matrices and: 1) adds them (if compatible) and prints their sum, 2) subtracts them (if compatible) and prints their difference, and 3) multiplies them (if compatible) and prints their product. Prompt the user for the names of two matrix input files (see format below) and place the output in a file of the user’s choosing. The format of the input files should contain the number of rows, followed...
write a code that plots columns in a matrix one by one. while plotting, the code should allow 2 seconds to see each column plotted before moving to the other one. During those 2 seconds the user should have the ability to print the plotted vector by clicking it?
Write a method to multiply two matrices. The header of the method is: public static double[][] multiplyMatrix(double[][] a, double[][] b) To multiply matrix a by matrix b, the number of columns in a must be the same as the number of rows in b, and the two matrices must have elements of the same or compatible types. Let c be the result of the multiplication. Assume the column size of matrix a is n. Each element is For example, for...
C++ CODE: The matrix class consists of two files: matrix.h and matrix.cpp. The class has the following definition: matrix -size:int -mat:int** ---------------- +matrix(file:string) +~matrix() +operator +(add:matrix*):matrix & +operator-(sub:matrix*):matrix & +friend operator<<(out:ostream &, t:const matrix&):ostream & +displayRow(r:int):void The class variables are as follows: • size: the number of rows and columns in a square matrix • mat: the integer matrix that contains the numeric matrix itself. The methods have the following behaviour: 2 • matrix(file:string): The default constructor. It receives the...
Create a program that:Receives as input in command line the sizes [rows] and [cols] of a two dimensional array, and [minValue] and [maxValue] between which the random numbers will be generated. Assume maxValue <= 999Generates two random two dimensional array with numbers between minValue and maxValue (inclusive) with the given size (rows x cols), and store them in m1 and m2Compute the sum of the two matrices and stores the result in a new matrix mSum.
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);...
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....