Matrix multiply with a function
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Indikatop
am 22 Okt. 2019
Kommentiert: Andrei Bobrov
am 22 Okt. 2019
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 Kommentare
Akzeptierte Antwort
Andrei Bobrov
am 22 Okt. 2019
Bearbeitet: Andrei Bobrov
am 22 Okt. 2019
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 Kommentare
Rik
am 22 Okt. 2019
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
am 22 Okt. 2019
@Indikatop: Please attach your txt or xlsx file here and we show how it do.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!