ABCs_arrays

ABCs_arrays - Store your % answer in the variable...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [A B C D E F G H] = ABCs_arrays(mat1,mat2) % (a) Create an array that has the numbers 1, 2, and 5 in the first row, % and the numbers 9, 11, and 15 in the second. Store your answer in % the variable "A". A = [1 2 5; 9 11 15]; % (b) Create a array of ones that has 5 rows and 10 columns. Store your % answer in a variable called "B". B = ones(5,10); % (c) The array "mat1" has been given to you. Find the number of rows % and columns in "mat1", and save your answer in "C" (rows) and "D" % (columns). [C D] = size(mat1); % (d) Vertically concatenate the arrays "mat1" and "mat2".
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Store your % answer in the variable "E". E = [mat1; mat2]; % (e) Take the top half of the array stored in the variable % "mat2"- that is, take all of the columns and the first half of the % rows. Store your answer in the variable "F". F = mat2(1:round(end/2),:); % (f) Transpose "mat2". Save your answer in the variable "G". G = mat2'; % (g) Linearize "mat1". "mat1" should go from a MxN array to a (M*N)x1 % array. Store your answer in "H". H = mat1(:);...
View Full Document

Ask a homework question - tutors are online