Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Store the values of matrix within a for loop and perform a series of calculations

조회 수: 1 (최근 30일)
Nikolaos Zafirakis
Nikolaos Zafirakis 2019년 7월 10일
마감: MATLAB Answer Bot 2021년 8월 20일
A = (1:100,1)
B = (1:100,1)
C = (1:100,1:3)
for ind = 1:length(la)
Z2(:,:,ind) = [cos(A(ind,:)) 0 -sin(A(ind,:));0 1 0;sin(A(ind,:)) 0 cos(A(ind,:))];
Z3(:,:,ind) = [cos(B(ind,:)) sin(B(ind,:)) 0;-sin(B(ind,:)) cos(B(ind,:)) 0;0 0 1]; % Up until here everything works perfectly I get a series of multiple matrices!
Tran(:,:,ind) = mtimes((transpose( mtimes( Z2(:,:,ind) , Z3(:,:,ind)))) , (C(ind,:))); % The issue is the calculation errors here and I don't know how to fix this!
end

답변 (1개)

Navya Seelam
Navya Seelam 2019년 7월 17일
Hi,
Firstly, the line A=(1:100,1) gives error. So, try using this
A= [1:100 1];
When ind=1, in case of Z2, dimensions of arrays being concatenated do not match. Same is the case with Z3. So, make sure that the matrix dimensions match when concatenating. In case of Tran, re-check if the matrix dimensions match for multiplication.
For more details check the MATLAB documentation

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by