Finding Max value on peak point of graph (logistics growth model)

조회 수: 6 (최근 30일)
Is there a method in matlab where i can find the value of the point in the graph (red arrow) before it plateues. I was thinking of using the gradient function. But unable to get any. Some help please !
  댓글 수: 2
dpb
dpb 2021년 3월 27일
Have more success if attach the data file, probably, so folks have something to work from.
save the variable and attach the .mat file
Nirmal Kishore Janakiraman
Nirmal Kishore Janakiraman 2021년 3월 30일
편집: Nirmal Kishore Janakiraman 2021년 3월 30일
Thank you sir. I have attached below and what is it that im trying to find.

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

채택된 답변

Ananya Tewari
Ananya Tewari 2021년 3월 30일
I understand you want the coordinates of the point after which the graph plateaus. Assuming you are having the data points of the graph, using movmax we can get the desired result.
maxi = movmax(data,[0 2]); % Taking 3 values at a time and finding maximum of them
idx = 0; % this will capture the index after which the graph plateaus
for k = 1:n % where n is number of data points
% when the middle value of the 3 elements is the largest we break the loop
if(maxi(k) == data(k+1))
idx = k;
break;
end
end
  댓글 수: 3
Ananya Tewari
Ananya Tewari 2021년 3월 31일
Hi Nirmal,
The ischange() finds abrupt changes in a given data and this function can be leveraged to find the approximate point after which the graph plateaus.A possible workaround is as follows:
data = biomass_conc(1,:) %data-points
x=1:5000
% Find change points
changeIndices = ischange(biomass_conc,'linear','MaxNumChanges',20,...
'SamplePoints',x);
% Display results
clf
plot(x,biomass_conc,'Color',[109 185 226]/255,'DisplayName','Input data')
hold on
% Plot change points
x2 = repelem(x(changeIndices),3);
y = repmat([ylim(gca) NaN]',nnz(changeIndices),1);
plot(x2,y,'Color',[51 160 44]/255,'LineWidth',1,'DisplayName','Change points')
title(['Number of change points: ' num2str(nnz(changeIndices))])
hold off
% The last value of x2 contains the approximate x-coordinate after which
% the graph plateaus
x_dash = x2(end) % x-coordinate
y_dash = biomass_conc(x_dash) % corresponding y-coordinate
Nirmal Kishore Janakiraman
Nirmal Kishore Janakiraman 2021년 4월 1일
Dear Ananya,
Thank you very much for your assistance on this. Appreciate it a lot!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by