i have two matrix with same columns and rows(matrix a and b). a is depth and b is land use index. each index value has a different equation and it is function of depth. i need to create a third matrix by substituting depth value to the functions.
depth d={2 3 4;7 2 5;1 2 5}
land use l={a b c;b c a;c b a}
a=0.5*depth+3
b=0.78*depth+4
c=0.1*depth+8
I really appreciate your cooperation. Thank you

댓글 수: 4

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 10월 22일
Sorry the question is not clear to me?
land use l={a b c;b c a;c b a}
Is this cell array with strings? Use??
Indikatop
Indikatop 2019년 10월 22일
It is a 3x3 matrix
Adam
Adam 2019년 10월 22일
Why is this flagged as Unclear? It has an accepted answer.
Andrei Bobrov
Andrei Bobrov 2019년 10월 22일
I'm fix :)

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

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2019년 10월 22일
편집: Andrei Bobrov 2019년 10월 22일

1 개 추천

i = [1:3;2,3,1;3:-1:1];
k = [.5;.78;.1];
f = [3;4;8];
d=[2 3 4;7 2 5;1 2 5];
l = k(i).*d + f(i);
or
l = kron(k(i),d) + kron(ones(size(i)),f(i));

댓글 수: 3

Indikatop
Indikatop 2019년 10월 22일
Thank you Mr. Andrei for your answer. if d and i in excel or txt format how you do that?
Rik
Rik 2019년 10월 22일
Then you need to load them as variables. I'm sure Google will be able to supply you with dozens if not hundreds of examples of how to read data from Excel to Matlab.
Andrei Bobrov
Andrei Bobrov 2019년 10월 22일
@Indikatop: Please attach your txt or xlsx file here and we show how it do.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품

태그

질문:

2019년 10월 22일

댓글:

2019년 10월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by