필터 지우기
필터 지우기

How can I use summation and product, simultaneously???

조회 수: 1 (최근 30일)
연승 김
연승 김 2021년 3월 17일
댓글: 연승 김 2021년 3월 17일
Firstable Thank you for your kind.
I'm not good at MATLAB, so I always get information from this web-site.
I want to use summation(symsum) and product(symprod), simultaneously??
The equation is below.
plz help me...

채택된 답변

KSSV
KSSV 2021년 3월 17일
Something like this:
m = 2 ; % i
n = 3 ; % j
C = rand(m,1) ;
k = rand(m,n) ;
M = rand(m,n) ;
iwant = zeros(m,1) ;
for i = 1:m
p = 1 ;
for j = 1:n
p = p*(1-k(i,j))^M(i,j) ;
end
iwant(i) = C(i)*p ;
end
Please cross check the code, I gave it quickly.
  댓글 수: 3
Steven Lord
Steven Lord 2021년 3월 17일
symsum and symprod are not the right tools for this job. You cannot use them to evaluate expressions where the symbolic variables are used as indices into an array.
syms k
symsum(2.^k, k, 1, 10) % works
ans = 
2046
x = 1:10;
symsum(x(k), k, 1, 10) % does not work
Error using sym/subsindex (line 864)
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must be sym expression.
연승 김
연승 김 2021년 3월 17일
Okay I understand!
THANK YOU for your kind!! Be happy^^

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

추가 답변 (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