How to find the centroid of curve ?
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Image Analyst
el 27 de Sept. de 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);
0 comentarios
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!