Let B element R^m times n and C element R^5 times 3 be matrices which have alrea
ID: 3783165 • Letter: L
Question
Let B element R^m times n and C element R^5 times 3 be matrices which have already been generated in the Command Window. Use two MATLAB statements in each part, the first generates the new matrix, and the second modifies it. Don't include the output. Let E_1 be the same as B, but b_2, 3 is replaced by 999. Let E_2 be the same as B but its third row is replaced by (2, 3, 4, 5, ....) Let E_3 be the same as B but the 2^nd through the 6^th rows and the 3^rd, 4^th, and 9^th columns are replaced by C. Let E_4 be the same as B but its 3^rd and 4^th columns are reversed. Let E_5 be the same as B but all its columns are moved one to the right, except the last one which is moved to the first. That is, E = (b_n, b_1, b_2, ..., b_n - 1). Let E_6 be the same as B except that the first column is deleted. That is, E = (b_2, b_3, ..., b_n).Explanation / Answer
clc;
clear all;
% Given That
m=20;
n=20;
B=rand(m,n);
C=ones(5,3);
%% Part a
E1=B;
E1(2,3)=999;
%% Part b
E2=B;
E2(3,:)=2:(size(E1,2)+1);
%% Part c
E3=B;
E3(2:6,[3 4 9])=C;
%% Part d
E4=B;
E4(:,3:4)=flipud(E4(:,3:4));
%% Part e
E5=B;
E5=circshift(E5, [0 1]);
%% Part f
E6=B;
E6=E6(:,2:end);
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.