Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm not sure which MATLAB command performs the same operation at this. could you please help? ExERCISE2 (3 points) Difficulty: Easy DESCRIPTION: In this exercise,

image text in transcribed

I'm not sure which MATLAB command performs the same operation at this. could you please help?

ExERCISE2 (3 points) Difficulty: Easy DESCRIPTION: In this exercise, you will create a function in the file in MATLAB (see Project0) using the given code, and run the function on the given matrices. The function (code) takes two matrices A and B as inputs and returns a single matrix C if the dimensions of A and B agree; otherwise it returns an empty matrix, C [] function C-trial (A, B) [m,pl-size (A) g,n ize (B) if pq C-zeros (m,n f r i=1 :n end C= [ ] ; E(:,1)-A#8 ( : , i); else disp ('The dimensions of A and B disagree') end end **Create the function trial in a file in MATLAB **Type the created function in the diary file ** Run the function c-trial (A, B) on the matrices given below to get the output C: (a) A-randi( 10,35), B=ones(3,5) (b) A-magic(4), B-ones(4,3) (c) A-magic(5), Bones(5) **Write a single MATLAB command that performs the same operation on matrices A and B as the function above. Execute it in your diary file on the given matrices. You may receive an error message from MATLAB if the dimensions of the matrices do not match - do not delete it from your diary file %Compare the outputs after executing the function and the single command and write a comment whether they match or not. 90 Write a comment on the form of the outputs for parts (b) and (c) (take into consideration the properties of the matrix magic)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions