How to find the centroid of curve ?

조회 수: 21 (최근 30일)
Sambit Supriya Dash
Sambit Supriya Dash . 2021년 9월 27일
답변: Image Analyst . 2021년 9월 27일
I have a curve fitted to a given data and got this curve(x).
curve(x) = a*exp(b*x) + c*exp(d*x)
Coefficients (with 95% confidence bounds):
a = -5458 (-6549, -4368)
b = 0.1531 (0.1456, 0.1606)
c = -2085 (-3172, -997.9)
d = 0.2584 (0.2182, 0.2986)
How to find the (x,y) of the centroid of the curve (in any curve) in MATLAB ?
  댓글 수: 2
Sambit Supriya Dash
Sambit Supriya Dash 2021년 9월 27일
I got your point, thank you for the hint.

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

답변 (1개)

Image Analyst
Image Analyst 2021년 9월 27일
Try this:
% Coefficients (with 95% confidence bounds):
a = -5458 % (-6549, -4368)
b = 0.1531 % (0.1456, 0.1606)
c = -2085 % (-3172, -997.9)
d = 0.2584 % (0.2182, 0.2986)
% Declare the range over which you want to evaluate the curve.
x = linspace(-10, 10, 2000);
% Get the y values for the curve.
curve = a*exp(b*x) + c*exp(d*x)
% Plot the curve.
plot(x, curve, 'b-', 'LineWidth', 2);
grid on;
fontSize = 20;
title('a*exp(b*x) + c*exp(d*x)', 'FontSize', fontSize);
xlabel('x', 'FontSize', fontSize);
ylabel('curve', 'FontSize', fontSize);
% Find mean.
meanx = mean(x)
meany = mean(curve);
% Plot mean on the graph.
hold on;
plot(meanx, meany, 'r+', 'LineWidth', 2, 'MarkerSize', 40);

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by