필터 지우기
필터 지우기

Summation using symsum of matrix

조회 수: 3 (최근 30일)
Penglin Cai
Penglin Cai 2020년 6월 11일
편집: Gaurav Aggarwal 2020년 6월 13일
How can l use MATLAB to do the summation as shown above? i=1, n=5, x and y are variables, Sij is a nxn matrix, beta and gamma are constant. I tried to use symsum but the MATLAB does not allow me to exctract the element in the matrix Sij or in the vector x and y. The code i tried is:
symsum(S(1,j)*(x(j)-beta*u(j))-gamma*(x(1)-betay(1)
Could you help me please.
  댓글 수: 1
Gaurav Aggarwal
Gaurav Aggarwal 2020년 6월 13일
편집: Gaurav Aggarwal 2020년 6월 13일
I haven't anywhere seen symsum doing the indexing in a structured data. Do you have to use symsum only?
I believe something on the following lines could be helpful, please do verify if the following equation does what you are trying to do.
sum(S(i,1:n) .* (x(1:n) - beta*y(1:n)) - gamma * (x(i) - beta*(y(i))))

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

답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by