I have a question regarding matrix multiplication using for loop for a general matrix
n1=1; n2=4; n3=4; n4=2;
Ai is the general matrix from this to find the value of A1 ,A2 ,A3 and A4
Ai= [ni ni^2; cos(ni) sin(ni)]
Display of matrix A1,A2,A3 and A4
Display of A1*A2*A3*A4.

댓글 수: 10

KSSV
KSSV 2021년 1월 29일
What have you attempted?
shiv gaur
shiv gaur 2021년 1월 29일
pl write the code
for i=1:4
n1=1; n2=4; n3=4; n4=2;
%Ai is the general matrix from this to find the value of A1 ,A2 ,A3 and A4
Ai= [ni ni^2; cos(ni) sin(ni)]
display([A1 A2 A3 A4])
end
n1=1; n2=4; n3=4; n4=2;
Ai= [ni ni^2; cos(ni) sin(ni)]
What that is supposed to tell you is that the matrices are
A1 = [n1, n1^2; cos(n1), sin(n1)]
A2 = [n2, n2^2; cos(n2), sin(n2)]
A3 = [n3, n3^2; cos(n3), sin(n3)]
A4 = [n4, n4^2; cos(n4), sin(n4)]
shiv gaur
shiv gaur 2021년 1월 29일
yes
shiv gaur
shiv gaur 2021년 1월 29일
pl any one write the code of multiplication of this
expression_that_pulls_out_A1 * expression_that_pulls_out_A2 * expression_that_pulls_out_A3 * expression_that_pulls_out_A4
For expression_that_pulls_out_An substitute appropriate code according to how you choose to implement creating variables in a loop. For example if you put them as rows in a table object, MYTABLE then
MYTABLE{1,1} * MYTABLE{2,1} * MYTABLE{3,1} * MYTABLE{4,1}
shiv gaur
shiv gaur 2021년 1월 29일
write code
I just did.
%{
MYTABLE{1,1} * MYTABLE{2,1} * MYTABLE{3,1} * MYTABLE{4,1}
%}
That is code.
I will give you a further hint:
P = cell(10,1);
for K = 1 : 10
P{K} = randi(10,1,50);
end
Total = 0;
for K = 1 : 10
Total = Total + P{K};
end
plot(Total)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2021년 1월 29일

댓글:

2021년 1월 29일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by