Fitting a model to a displacement field

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

Hello,
Your data in file 'Coordinates before and after .csv' contain NaNs, these values cannot be used for the interpolation. Therefore, the NaN values would first need to be removed from your dataset.
You provided a list of the X-Y coordinates before and after the deformation at particular locations. Do these coordinates correspond to an 1D or to a 2D body? If they correspond to a 2D body, then are the data scattered or gridded? This knowledge is necessary in order to use the right MATLAB function for your needs.
Kind Regards,
Andreas
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
Holmbrero
Holmbrero 2021년 3월 30일
The new file is uploaded.

댓글을 달려면 로그인하십시오.

답변 (1개)

Nipun
Nipun 2024년 5월 22일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2021년 3월 30일

답변:

2024년 5월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by