How to calculate with sigma notation in matlab?

조회 수: 297 (최근 30일)
catarina
catarina 2012년 1월 4일
편집: Walter Roberson 2021년 3월 25일
Hello,
I've been looking everywhere about how to calculate with sigma notation in matlab. I found some info such as syms and symsum but don't seem to be able to use it. I need it to calculate the following:
Fn=N-1
Sigma (fnj)
j=0
How would I write the code for it?
Anyone that can help? Thanks
catarina
  댓글 수: 3
shanthini vikraman
shanthini vikraman 2017년 3월 1일
in matlabR2010 error shown in sigma what shall i do to rectify this error. this is the line shown .Error in ==> cannytry1 at 31 size_of_kernel = 6*sigma+1
Walter Roberson
Walter Roberson 2017년 3월 1일
shanthini vikraman
The sigma there appears to be unrelated to the sigma being talked about in this question; in this question, sigma is being used for summation.
Unfortunately you did not include the complete error message so it is difficult to say what is happening.
One possibility is that you invoked a function without passing in enough arguments. For example you might have used the Run button on a function that expects inputs; for such a function you need to go to the command line and call the function from there indicating the inputs to use.

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

답변 (1개)

David Young
David Young 2012년 1월 4일
If you need a numerical result, the sigma notation turns into a call to the sum() function. Your example might look something like this (with random numbers substituted for your data):
N = 100;
fn = rand(N, 1);
Fn = sum(fn);
Note that MATLAB array indices start from 1, so although in your formula the index j runs from 0 to N-1, in MATLAB the vector index runs from 1 to N. You may need to take account of this when you compute whatever is to be stored in fn.
(I assume that "Fn=" is on the wrong line of your formula, which should look like
N-1
Fn = Sigma fn
j=0 j
)
If you want a symbolic result using the Symbolic Math Toolbox, then someone else will need to help.

카테고리

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