필터 지우기
필터 지우기

write max mean as an alternative

조회 수: 4 (최근 30일)
Ugur Sahin
Ugur Sahin 2020년 4월 7일
댓글: Ugur Sahin 2020년 4월 7일
Hi guys,
I am trying to write max() and min but our teacher said you cannot use max() and min() function. how can ı write alternativly these functions. I have done mean value like that:
if length(m)==4
element=element+1;
s =sum(m) / 4;
arc = [arc s];
m=[];
end
every 4 step m function reset and also values that have been in m (m has 4 element at the moment) sums and divide 4. the new value (mean value of a at the moment) goes arc.
I want to da that max and min version without max and min command but this time the values has to go new set that ı called maxvalues and min values could someone help me ?
  댓글 수: 3
Ugur Sahin
Ugur Sahin 2020년 4월 7일
https://imgur.com/a/wjWhlTQ
Image Analyst
Image Analyst 2020년 4월 7일
Ugur, post the image directly here with the green and brown frame icon, not on some third party web site.

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

채택된 답변

David Hill
David Hill 2020년 4월 7일
a=sort(x)
maxvalue=a(end);
minvalue=a(1);
  댓글 수: 3
David Hill
David Hill 2020년 4월 7일
maxvalue=x(1);
minvalue=x(1);
for k=2:length(x)
if x(k)>maxvalue
maxvalue=x(k);
elseif x(k)<minvalue
minvalue=x(k);
end
end
Ugur Sahin
Ugur Sahin 2020년 4월 7일
thank you so much :D

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by