how edit code in matlab

조회 수: 2 (최근 30일)
work wolf
work wolf 2016년 2월 26일
편집: work wolf 2016년 3월 11일
how edit code matlab for change some comments
  댓글 수: 2
Walter Roberson
Walter Roberson 2016년 2월 26일
That image is too small and too faint for me to read. Please post a more legible version. Assume that some of us are half blind.
James Tursa
James Tursa 2016년 2월 27일
Do you have a specific function you are working with?

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

채택된 답변

Walter Roberson
Walter Roberson 2016년 2월 27일
sum( abs(diff(f(x))) .* diff(x) )

추가 답변 (1개)

John BG
John BG 2016년 2월 27일
assuming you have sampled often enough to catch the true max min values, to avoid missing max or min when searching for U and L within [x(i) x(i+1)] then define reference vector x
x=[0:.1:10]
f=@(x) sin(x)
y=f(x)
z=zeros(1,length(x)-1)
for i=2:length(x)
z(i)=(max(y(i),y(i-1))-min(y(i),y(i-1)))*(x(i)-x(i-1))
end
sum(z)
redefine x and the function f to your values of interest.
If you find this answer of any help solving this question, please click on the thumbs-up vote link,
thanks in advance
John

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by