so i have this matrix
A=
7
B=
0.34 0.34 0.34
0.50 0.25 0.25
and this matrix
C=
1
1
4
2
3
6
3
with this rule:
- if t=1 then the output = mp*(fp first row)
- if t=2 then the output = mp*(fp 2nd row)
if t not 1 or 2 then output = t
so the output should be like this:
output=
7.14
7.14
4
7
3
6
3
im trying using this code but its doesnt work
sizeA=size(A,1)
sizeB=size(B,1)
for i=1:sizeB
if (B(i)<=sizeA)
Output=sum(repmat(A,1,length(C))'.*B(C,:),2)
else
Output=C(i)
end
end
Aucun commentaire:
Enregistrer un commentaire