How to determine whether a polynomial to a power of 5 or 6 is the best fit to test data

3 views (last 30 days)
I have experimental data as seen below and using a material evaluate function through finite element modelling I have extracted the following strain energy potentials which are polynomials to the power of 5 and to the power of 6. My aim is to determine is the strain energy potential to the power of 5 or to the power of 6 a best fit to the experimental data.
The way I have gone about this is to create a vector with a specified number of points equally spaced (in this case 10 as seen in code below), then using the equation from the curve created from plotting ('Hyper_Strain') with ('Hyper_Stress') fitting this with a polynomial to the power of five. However, I know that through calling A I am only calling Hyper_Stress. Does anybody know how to first find the equation of the curve generated from plotting ('Hyper_Stress') and ('Hyper_Strain') and then determining whether or not a polynomial to the power of 5 or 6 is the best fit to this data?
Or even to find an R^2 value between the ('Hyper_Stress') and ('Hyper_Strain') curve and the Ogden5_stress and Ogden5_strain curve
firstly, followed by an R^2 value for the ('Hyper_Stress') and ('Hyper_Strain') curve and the Ogden6_stress and Ogden6_strain curve . I have attached all of the relevant documents to go with the code.
Any help would be much appreciated here. Thank you in advance.
fileID = fopen('Hyper_Stress.txt');
formatSpec =('%f');
sizeA = [1 Inf];
A=fscanf(fileID,formatSpec,sizeA);
fileID = fopen('Hyper_Strain.txt');
formatSpec =('%f');
sizeB = [1 Inf];
B=fscanf(fileID,formatSpec,sizeB);
fileID = fopen('Ogden5_stress.txt');
formatSpec =('%f');
sizeC = [1 Inf];
C=fscanf(fileID,formatSpec,sizeC);
fileID = fopen('Ogden5_strain.txt');
formatSpec =('%f');
sizeD = [1 Inf];
D=fscanf(fileID,formatSpec,sizeD);
fileID = fopen('Ogden6_stress.txt');
formatSpec =('%f');
sizeE = [1 Inf];
E=fscanf(fileID,formatSpec,sizeE);
fileID = fopen('Ogden6_strain.txt');
formatSpec =('%f');
sizeF = [1 Inf];
F=fscanf(fileID,formatSpec,sizeF);
figure(1)
plot(B,A,D,C,F,E)
legend('Test Data', 'Ogden_5', 'Ogden_6')
x = linspace(0,1,10);
y = A;
p = polyfit(x,y,5);
x1 = linspace(0,6);
y1 = A;
f1 = polyval(p,x1);
figure
plot(x,y,'o')
holg on
plot(x1,y1)
plot(x1,f1,'r--')
legend('y','y1','f1')
  6 Comments
dpb
dpb on 9 Mar 2020
What's the end purpose of the fit?
Some of the data (at least the first, haven't bothered to download all the rest; would be much more convenient for others if would attach .mat file of all as 2D array altho I suppose they don't all have the same number of points?) has a decrease at the end -- is that portion of the data to be included?
I think the question of symmetry around the zero strain isn't of any help here; it's not a symmetrical physical system and a polynomial of any degree is simply an interpolating/condensing crutch to hopefully reduce the measured data to a small representative set of coefficients that can at least adequately reproduce the data over the test range.
Anything outside that, either way, is almost assuredly going to be nonsense (and some within may be as well, depending upon just what the shape actually is).
Are the few datapoints at the beginning with negative stress real--or should they not be eliminated first?

Sign in to comment.

Answers (0)

Categories

Find more on Stress and Strain in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!