How to find the centroid of curve ?

15 vues (au cours des 30 derniers jours)
Sambit Supriya Dash
Sambit Supriya Dash le 27 Sep 2021
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 commentaires
KSSV
KSSV le 27 Sep 2021
Read about mean.
Sambit Supriya Dash
Sambit Supriya Dash le 27 Sep 2021
I got your point, thank you for the hint.

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 27 Sep 2021
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);

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by