Calculate the power using the current values inside matrix

how do you work out a loop to calculate power when you have been give the current ( a 6*6)matrix. and your answer in a matrix form should have 36 members annd you are supposed to have 6 loop sentences to calculate the 36 values?

댓글 수: 2

Do you need the voltage to calculate the power from current?
Is the current a 6*6 matrix as in your question, or a 6*1 matrix as in your Tags ?

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

답변 (2개)

Walter Roberson
Walter Roberson 2011년 8월 10일
For the case where they are 6 x 1, something like:
bsxfun(@times, current(:), voltage(:).')
Fangjun Jiang
Fangjun Jiang 2011년 8월 10일
Voltage=1:6;
Current=0.1:0.1:0.6;
Power=zeros(6,6);
for k=1:6
for j=1:6
Power(k,j)=Voltage(k)*Current(j);
end
end

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

질문:

2011년 8월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by