Curve fitting to an excel file
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
James Blackwell
el 15 de Nov. de 2018
Comentada: James Blackwell
el 16 de Nov. de 2018
Hi,
I am trying to fit an analytic formula to an experiment I carried out. It's a simple compression test of a material.
The code to generate a plot is:
a = 133; % area of surface mm^2
Area = pi*a^2;
%Want to plot Sigma v L
W1 = 0.01;
W2 = 0.01;
L = linspace(1,0.8,225);
sigma = (2.*W1.*((L.^2) - 1./L) - 2.*W2.*((1./L.^2) - L));
F = -(Area .* sigma);
deformation = (1-L)*100
plot(deformation,F)
xlabel('% strain'), ylabel('Force mN')
W1 & W2 are just placeholder values, those are the values I am trying to find. They give a value of roughly 1600mN at 20% which is close to the actual value of 1815, but the shape is off. It is linear rather than a gentle curve
I would like to do a non-linear least squares fit to the data I have.
I can input the excel file and it all shows up fine. I have data of both strain and Force.
filename = 'C_P_1.xlsx';
Test = xlsread(filename);
But I don't know how to implement the fitting. Starting values for the strain would be 0%, finishing at 20%. Starting values for the force are 0 and finish at 1815 mN at 20% strain.
Any help would be greatly appreciated!
0 comentarios
Respuesta aceptada
madhan ravi
el 15 de Nov. de 2018
Editada: madhan ravi
el 15 de Nov. de 2018
a = 133; % area of surface mm^2
Area = pi*a^2;
%Want to plot Sigma v L
W1 = 0.01;
W2 = 0.01;
L = linspace(1,0.8,225);
sigma = (2.*W1.*((L.^2) - 1./L) - 2.*W2.*((1./L.^2) - L));
F = -(Area .* sigma);
deformation = (1-L)*100;
xx=linspace(deformation(1),deformation(end),1000);
yy=interp1(deformation,F,xx,'spline');
plot(deformation,F,'o',xx,yy,'r')
xlabel('% strain'), ylabel('Force mN')
Más respuestas (0)
Ver también
Categorías
Más información sobre Get Started with Curve Fitting Toolbox 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!