I wrote this program but it's not working could anyone tell me what's the problem please?
writing a formula in matlab
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello all I have a formula that I want to write it in matlab but I don't know about sigma and Combination,can anyone help me please the formula is

i want to calculate 'C' amount but when it is less or equal with 0 'C=0' and when it is bigger than 0 C amount=the calculated amount all of the amounts (r,u,d,n,St-n,k) are given ('p' should calculate) and if it is possible I want to do it with xlsread for given data and rewrite C amount in the main excel file I don't know i explained it well or not :( thanks for all of your helps
답변 (1개)
Geoff Hayes
2018년 4월 30일
댓글 수: 11
Geoff Hayes
2018년 5월 5일
The error message is telling you that there is a problem with the brackets in your line of code - possibly too many. You may want something like
C=(1/(1+r)^n)*symsum(nchoosek(n,j)*p^j*(1-p)^(n-j)*max(0,((1+u)^j)*(1+d)^(n-j)*St/K),j,0,n)
Please verify which are the inputs to your symsum function call.
참고 항목
카테고리
Help Center 및 File Exchange에서 Programming Utilities에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!