Fitting a model to a displacement field
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi!
I have aquired a displacement field from image analysis and i want to fit a model to the field in order to be able to derive the strain.
I tried to interpolate between the points to find a function that fits but the results are not good.
The attached file contains the coordinates of the feature before (column 1 and 2) and the coordinates of the same feature after (column 3 and 4) so that for example row 1 contains the x and y coordinates of the feature before and after.
Any suggestions on where to start would be greatly appriciated.
Regards,
3 comentarios
Respuestas (1)
Nipun
el 22 de Mayo de 2024
Hi Holmbrero,
I understand that you are trying to fit a model to a displacement field derived from image analysis to calculate strain. Given the coordinates before and after deformation, you can use polynomial fitting to model the displacement and then derive strain components from this model.
Here is a MATLAB approach to accomplish this:
% Assuming 'data' is a matrix where columns 1 and 2 are the initial (x, y) coordinates,
% and columns 3 and 4 are the final (x', y') coordinates
x = data(:,1);
y = data(:,2);
xp = data(:,3); % x prime (x')
yp = data(:,4); % y prime (y')
% Calculate displacement vectors
u = xp - x; % Displacement in x direction
v = yp - y; % Displacement in y direction
% Fit polynomial models to the displacement fields
% Adjust 'poly11' for higher order polynomials if needed
ft_u = fittype('poly11'); % Polynomial type for u
ft_v = fittype('poly11'); % Polynomial type for v
% Perform the fitting
[fitresult_u, gof_u] = fit([x, y], u, ft_u);
[fitresult_v, gof_v] = fit([x, y], v, ft_v);
% Display the fit results
disp('Fit for u (x displacement):');
disp(fitresult_u);
disp('Fit for v (y displacement):');
disp(fitresult_v);
% Assuming a linear model, calculate strain components
% For more complex models, differentiate accordingly
epsilon_xx = diff(fitresult_u, x, 'x'); % ∂u/∂x
epsilon_yy = diff(fitresult_v, y, 'y'); % ∂v/∂y
gamma_xy = diff(fitresult_u, y, 'y') + diff(fitresult_v, x, 'x'); % ∂u/∂y + ∂v/∂x
% Note: differentiate is a placeholder function for the concept of differentiation. In practice, you need to
% extract the coefficients from the fit results and manually calculate the derivatives for your specific polynomial model.
For more information on "fittype" and "diff" functions in MATLAB, refer to the following MathWorks documentation:
- "fittype" function : https://in.mathworks.com/help/curvefit/fittype.html
- "diff" function : https://in.mathworks.com/help/symbolic/diff.html
Hope this helps.
Regards,
Nipun
0 comentarios
Ver también
Categorías
Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!