matrix definition through indivisual call

how to call matrix elements in terms of i j such that i can call indivisual element and then form a matrix.

댓글 수: 4

Something like this?
A = [1,2,3;4,5,6;7,8,9];
for i = 1:size(A,1)
for j = 1:length(A,2)
B(i,j) = A(i,j);
end
end
If this all you want to achieve then I am sure, there are lot of other better ways. Help us to understand the question more clearly. Cheers
pratik dangar
pratik dangar 2019년 8월 27일
basically the question i have is, i am trying to solve system of linear equations using matlab but in this i have to define matrix A and B in terms of i j where i=no. of row and j=no. of column..like i have enter value of A11 A12 and then i have to show the matrix
I think they are asking how to do dynamic variable names.

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

답변 (1개)

Anmol Dhiman
Anmol Dhiman 2019년 8월 30일

0 개 추천

To solve a system of linear equations you can use Symbolic Math Toolbox. Refer to below Link
If you wish to create your own matrix for a given size, you can use zeros function. You can access the individual elements as A(i,j), where i represents number of rows and represents number of columns, as shown below
A = zeros(3,3)
A(1,1) =4
A(1,3) =5

카테고리

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

질문:

2019년 8월 27일

댓글:

2019년 8월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by