Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB. I NEED TO MAKE A FUNCTION AND THEN PUT IT IN A SCRIPT.. THANKYOU ............................................................................................................................................. function [C]=matrixMulti(A,B) %% implement a matrix multiplication algorithm %

MATLAB. I NEED TO MAKE A FUNCTION AND THEN PUT IT IN A SCRIPT.. THANKYOU

.............................................................................................................................................

function [C]=matrixMulti(A,B)

%% implement a matrix multiplication algorithm

% C(i,j)=sum_over_k (A(i,k)*B(k,j), please review the slides to get familiar with

% matrix multiplication. You can access element X_ij as X(i,j) for matrix X.

% all of your code shoule be within this function.

%% to do list:

% 1. check if the # of columns of A is the same as the # of rows in B. if

% not, print an error message to the command window.

% 2. calculate C(i,j)

end

...................................................................................................................................................

% matrix multiplication

% 2/20/2018, jifutan@niu.edu

clear;clc;

MA=[1 2;3 4]; % matrix MA. Make sure you understand how to use ; in matrix

MB=[1 2 3;4 5 6]; % matrix MB

MC=[1 1;2 2;3 3]; % matrix MC.

%% call matrixMulti function to calcuate the product of MA, MB

% [C]=matrixMulti(A,B); % you need to change the argument name such that it

% is consistent with given variables.

% put your one line code here.

%% check your solution with matlab built in operator *. Does C you get from

% function matrixMulti match with MA*MB? How do you do that?

% put your one line code here.

%% call matrixMulti function to calcuate the product of MA, MC

% [C]=matrixMulti(A,B); % you need to change the argument name and output name

% such that it is consistent with given variables, or it is not overwritten

% existing variables.

% put your one line code here.

%% call matrixMulti function to calcuate the product of LA, LB,

LA=rand(50); % search built in function rand in matlab help

LB=rand(50,100);

% [C]=matrixMulti(A,B); % you need to change the argument name and output name

% such that it is consistent with given variables, or it is not overwritten

% existing variables.

% put your one line code here.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

evaluate signs to determine their value on communication.

Answered: 1 week ago