Code for elements in equation to create a matrix

조회 수: 1 (최근 30일)
lo
lo 2014년 3월 16일
답변: Muhammad Tabish Bilal 2021년 4월 22일
D is a 1x3 matrix
f is a 3x3 matrix
I want to create a matrix of A by the following equation:
for j=1:3
for i=1:3
A(i)=(sum(D(j).*f(i,j)))^-1;
end
end
But it turns out that the answer is wrong
What should be the correct code of this equation?

채택된 답변

Mischa Kim
Mischa Kim 2014년 3월 16일
Lo, no need to use loops:
A = 1./(f*D)
Make sure that D is a column vector.
  댓글 수: 1
lo
lo 2014년 3월 18일
편집: lo 2014년 3월 18일
how about if I want to get this equation
using the answer of A?
O is a 1x3 or 3x1 matrix

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

추가 답변 (1개)

Muhammad Tabish Bilal
Muhammad Tabish Bilal 2021년 4월 22일
for counter1= 1: 13 % counter for the rows of intended matrices
for counter2= 1 : 13 % counter for coloumns of intended matrices
SMO(counter1,counter2) = counter1+counter2; % here you may use the equation you want to drive a matrices from but keep in mind it should be a column matrices using the same counter of inner loop
end
end

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by