필터 지우기
필터 지우기

How do I put this formula int matlab?

조회 수: 2 (최근 30일)
Arda Nova
Arda Nova 2019년 3월 22일
답변: madhan ravi 2019년 3월 22일
z=imread('C:\Users\*****\Desktop\Matlab\Homework 3-02 03 04 05\Fig308a.jpg');
for i=1:255
y(i)=sum(z(:) == i);
end
n=488*373;
for j=1:255
s(j)=symsum(y(k)/n, k, 1, j); %% Talking about this part.
end
bar(y), figure, imhist(z), figure, bar(s)
Long story short, what I want to get is such that:
s(1)=y(1)/n
s(2)=y(1)/n+y(2)/n
...
I get the error saying:
"Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments
must be symbolic variables, and function body must be sym expression."
Ekran Alıntısı.PNGOriginial formula.
What should i use?
  댓글 수: 2
madhan ravi
madhan ravi 2019년 3월 22일
편집: madhan ravi 2019년 3월 22일
I am not able to interpret your formula but if the concept is this
s(1)=y(1)/n
s(2)=y(1)/n+y(2)/n
... then why not
cumsum(y/n) % ?
[comment moved to answer section]
Arda Nova
Arda Nova 2019년 3월 22일
Exactly what I am searching for. I tried to search summation types on matlab but couldn't come to this title. Thank you very much.

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

채택된 답변

madhan ravi
madhan ravi 2019년 3월 22일

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by