필터 지우기
필터 지우기

How to solve this in matlab?

조회 수: 1 (최근 30일)
Amir Hamzah UTeM
Amir Hamzah UTeM 2011년 4월 26일
Hi,did someone know how to convert this equation in matlab?i know this is easy since matlab have build in function.but i cant figure it how to do that in matlab,still new in matlab..
?Xab.Kab
a=1...nth value
b=1...nth value
Xab = X in pattern a and pattern b
Kab = K in pattern a and pattern b
thanks.
  댓글 수: 3
Amir Hamzah UTeM
Amir Hamzah UTeM 2011년 4월 26일
i want to solve sum(Xab.Kab) that sum symbol cant view here.. :(
Matt Fig
Matt Fig 2011년 4월 26일
So is Walter's solution what you are looking for? If not, and Paulo's is not either, please give a simple example, such as:
X = [2 3 4 8];
K = [7 5 6 9];
What do you want from these two vectors? Or do you need to work on arrays, such as:
X = [2 3; 4 8];
K = [7 5; 6 9];

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

답변 (2개)

Paulo Silva
Paulo Silva 2011년 4월 26일
%pre-allocate the vectors for Xab and Kab
Xab=zeros(1,na+nb-1);
Kab=0*Xab;
% can't decode this %?Xab.Kab
for a=1:na %a=1...nth value
for b=1:nb %b=1...nth value
Xab(a+b-1)=X; %Xab = X in pattern a and pattern b
Kab(a+b-1)=K; %Kab = K in pattern a and pattern b
end
end

Walter Roberson
Walter Roberson 2011년 4월 26일
I am not at all certain I am interpreting the question correctly, but possibly:
sum(X(:) .* K(:))
  댓글 수: 2
Andrei Bobrov
Andrei Bobrov 2011년 4월 26일
agree with Walter Roberson,"?Xab.Kab" - as a Maple matrix multiplication rtable - arrays...
Walter Roberson
Walter Roberson 2011년 4월 27일
sum of a matrix multiplication? Hmmm, possibly. The arrays are an acceptable shape for that.
sum(reshape(X*K,[],1))

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by