Fitting a model to a displacement field

4 次查看(过去 30 天)
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 个评论
Holmbrero
Holmbrero 2021-3-30
Hi!
Sorry for the NaNs, i remove all rows containing NaNs after i load the file into the script. I'll upload a new file shortly.
The data corresponds to a 2D body and is scattered.
Regards,
Anders

请先登录,再进行评论。

回答(1 个)

Nipun
Nipun 2024-5-22
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:
  1. "fittype" function : https://in.mathworks.com/help/curvefit/fittype.html
  2. "diff" function : https://in.mathworks.com/help/symbolic/diff.html
Hope this helps.
Regards,
Nipun

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by