Use one MATLAB statement to initialize the following vectors. You can include al
ID: 2253322 • Letter: U
Question
Use one MATLAB statement to initialize the following vectors. You can include all the statements in one m-file and test your result by taking n=5 at the beginning.In your assignment, you don’t need to include the output. All we need is your m-file
I ONLY NEED HELP WITH C FOR BOTH QUESTIONS
.
Let A and B be nxn matrix which have already been entered in the Command Window. a) Generate A N B A b) Generate where O is the zero matrix which is the same size as A. c) Generate where is the identity matrix which is the same size as AExplanation / Answer
%%% Matlab code %%
clc;
clear all;
close all;
format long;
%%% 1c) let A and B are defined
A=[3 4;5 6];
B=[4 5;8 9];
I=eye(size(A));
o=zeros(size(A));
c3=[B,I,o;o,B,I;I,o,B];
%%% 2c) let n=5;
n=5
for i=1:n
for j=i:n
if (i==j)
c(i,j)=2*j+1;
if (j+1)<=n
c(i,j+1)=n;
end
end
end
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.