Calculate cut-off point on a power regression model

2 次查看(过去 30 天)
Hello everyone,
I have a set of data of a gym exercise, on which I can plot the relationship between Acceleration (y) and Moment of Inertia (x) on a dispersion plot. Y is measured for equidistant Moments of Inertia increments starting from 0.005 kg·m2 to 0.300 kg·m2, every 0.005 kg·m2.
I would like to know if there is some way to could calculate a cut-off point on the x-axis (Moment of Inertia) which could differ between subjects measure on the performance level that they do for that exercise. Clearly, the relationship shows that those three subjects got a different level on the exercise, but differences are more likely on the lower momentos of inertia, tending to be similar at higher moments of inertia:
x1= [0.005:0.005:0.300];
y1 = [844 476 340 268 223 192 169 151 137 126 116 108 101 95 90 85 81 77 74 71 68 65 63 61 59 57 55 54 52 51 49 48 47 46 45 44 43 42 41 40 39 38 38 37 36 36 35 34 34 33 33 32 32 31 31 30 30 29 29 29
];
y2 = [1363 738 516 400 328 279 244 217 195 178 163 151 141 132 124 117 111 106 101 96 92 89 85 82 79 76 74 71 69 67 65 64 62 60 59 57 56 55 53 52 51 50 49 48 47 46 45 44 44 43 42 41 41 40 39 39 38 38 37 36
]
y3 = [379 215 154 121 101 87 77 69 62 57 53 49 46 43 41 39 37 35 34 32 31 30 29 28 27 26 25 25 24 23 23 22 21 21 20 20 20 19 19 18 18 18 17 17 17 16 16 16 15 15 15 15 15 14 14 14 14 13 13 13
];
figure; hold on;
scatter (x1,y1)
scatter (x1,y2)
scatter (x1,y3)
Resuming, do anyone got any idea of an objective calculation or method to could decide which Moment of Inertia could differ between the level of those three subjects? Idealy, if there would be any kind of axis intercept we could calculate, but the power relationship tends to show asympotetes. What is more, the Moments of Inertia are within this range because the device where the exercise is executed can only be set up for those moments of inertia.
Any idea or suggestion is appreciated.

回答(1 个)

Vinayak
Vinayak 2024-1-16
Hi Alejandro
The relationship between Moment of Inertia and acceleration is known to be inverse. To explore this relationship, using an inverse fit (y = a/x) instead of a power relationship could be a better approach. This allows for a direct comparison of the coefficients in different fits, helping in the assessment of performance.
In scenarios where you have distinct datasets with intersecting curves, you could identify the points of intersection using interpolation.
The sample code for finding intersection points is below:
% Modified data to get intersections
x1 = 0.005:0.005:0.300;
y1 = [844 656 476 340 268 245 223 192 183 169 151 137 126 120 116 108 105 101 95 93 90 85 81 77 75 74 71 68 67 65 63 61 59 58 57 56 55 54 52 51 49 48 47 47 46 46 45 45 44 44 43 43 42 42 42 41 41 41 40 40];
y2 = [1363 738 516 400 328 279 244 217 195 178 163 151 141 132 124 117 111 106 101 96 92 89 85 82 79 76 74 71 69 67 65 64 62 60 59 57 56 55 53 52 51 50 49 48 47 46 45 44 44 43 42 41 40 39 38 38 37 36 36 35];
y3 = [379 215 154 121 101 87 77 69 62 57 53 49 46 43 41 39 37 35 34 32 31 30 29 28 27 26 25 25 24 23 23 22 21 21 20 20 20 19 19 18 18 18 17 17 17 16 16 16 15 15 15 15 15 14 14 14 14 13 13 13];
fitmodel = fittype('a*x^b', 'coefficients', {'a','b'});
fit1 = fit(x1', y1', fitmodel, 'StartPoint', [floor(y1(1)*x1(1)),-1]);
fit2 = fit(x1', y2', fitmodel, 'StartPoint', [floor(y2(1)*x1(1)),-1]);
fit3 = fit(x1', y3', fitmodel, 'StartPoint', [floor(y3(1)*x1(1)),-1]);
figure;
hold on;
plot(fit1, 'r')
plot(fit2, 'g')
plot(fit3, 'b')
% Evaluate fits at the chosen x-values
x_values = linspace(0.0050,0.3000,10000);
y1_values = feval(fit1, x_values)';
y2_values = feval(fit2, x_values)';
y3_values = feval(fit3, x_values)';
% Initialize array to store intersection points
intersections = [];
% Find intersections
for i = 2:length(x_values)
% Check for sign changes in adjacent points
if sign(y1_values(i-1) - y2_values(i-1)) ~= sign(y1_values(i) - y2_values(i))
% Intersection found, interpolate for precise value
x_intersect = mean(interp1([y2_values(i-1), y2_values(i)], [x_values(i-1), x_values(i)], [y1_values(i-1) y1_values(i)]));
y_intersect = feval(fit1, x_intersect);
intersections = [intersections; x_intersect, y_intersect];
end
if sign(y2_values(i-1) - y3_values(i-1)) ~= sign(y2_values(i) - y3_values(i))
x_intersect = mean(interp1([y3_values(i-1), y3_values(i)], [x_values(i-1), x_values(i)], [y2_values(i-1) y2_values(i)]));
y_intersect = feval(fit2, x_intersect);
intersections = [intersections; x_intersect, y_intersect];
end
if sign(y3_values(i-1) - y1_values(i-1)) ~= sign(y3_values(i) - y1_values(i))
x_intersect = mean(interp1([y3_values(i-1), y3_values(i)], [x_values(i-1), x_values(i)], [y1_values(i-1) y1_values(i)]));
y_intersect = feval(fit3, x_intersect);
intersections = [intersections; x_intersect, y_intersect];
end
end
if numel(intersections) > 0
plot(intersections(:,1), intersections(:,2), 'k*', 'MarkerSize', 10);
end
% Add legend and labels
legend('Subject 1', 'Subject 2', 'Subject 3', 'Intersection');
xlabel('Moment of Inertia (kg·m^2)');
ylabel('Linear Acceleration (m/s^2)');
You may also refer to resources on fitting and interpolation for further information:
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Spline Postprocessing 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by