How can I perform a four dimensional curve fitting.

There is now a five-dimensional matrix that is calculated by the finite element method.
The resulting matrix Y is affected by the parameter matrices A, B, C, D.
Now I want to get Y=f(A, B, C, D) by means of curve fitting.
The data is in the attachment, the MATLAB code for reading in the data is as follows
%
clear;
clc;
ANG_1teeth = 360 / 23;
RR = 100;
ratio = 0.1:0.05:0.75;
theta_f = 5:1:30;
TangF = 500:500:5000;
NormalF = 0:500:1000;
for i = 1: length(NormalF)
for j = 1:length(TangF)
for k = 1: length(theta_f)
TSEQUENCE = 1;
filename=['E:\Test\TheLastReasultofHollowRing_SF\RingNf=' num2str(NormalF(i)) 'NTF=' num2str(TangF(j)) 'N' num2str(theta_f(k)) '°.lis'];
fidin=fopen(filename);
fidout=fopen('E:\Test\MKMATLAB.txt','wt'); % MKMATLAB.txt
while ~feof(fidin) % % 判断是否为文件末尾
tline=fgetl(fidin); %
tline = strtrim(tline); %
if double(tline(1))>=48&&double(tline(1))<=57 %
fprintf(fidout,'%s\n',tline); %
continue %
end
end
MK=importdata('E:\Test\MKMATLAB.txt'); %
fclose(fidout);
fclose(fidin);
fclose('all');
MKK = sortrows(MK,4);
rows = length(ratio);
columns = 10; % 总共10列
for ii = 1:rows
for jj = 1:columns
MKK_4(ii,jj,k,j,i) = MKK(ii,jj);
end
MKK_XRatio(ii,4,k,j,i) = MKK_4(ii,5,k,j,i)/MKK_4(ii,4,k,j,i); % ratio------------Independent variable
MKK_XTheta(ii,3,k,j,i) = MKK_4(ii,6,k,j,i); % theta_f------------Independent variable
MKK_XFT(ii,1,k,j,i) = MKK_4(ii,2,k,j,i); % FT------------Independent variable
MKK_XFA(ii,2,k,j,i) = MKK_4(ii,3,k,j,i); % FA------------Independent variable
MKK_UYM(ii,1,k,j,i) = MKK_4(ii,7,k,j,i); % UY_Max------------This is the dependent variable
end
end
end
end
The curve fitting formula for a single variable is as follows:
%%
% rational---------------1:ratio
ratio0 = 0.1:0.01:0.9;
p1_rario = 0.0002103;
q1_rario = 0.04092;
q2_rario = -0.0004491;
y_rational_ratio = (p1_rario) ./ (ratio0.^2 + q1_rario*ratio0 + q2_rario);
figure
plot(ratio0,y_rational_ratio,'r*')
grid on
title('ratio0(rrr/RR)')
% ---------------2:TF
TangF0 = 10:10:30000;
p1_TF =  6.198e-07;
p2_TF =  2.966e-11;
y_TF = p1_TF * TangF0 + p2_TF;
figure
plot(TangF0,y_TF,'r*')
grid on
title('TangF0')
% ---------------3:NF
NormalF0 = 10:10:30000;
p1_NF =  -5.067e-10;
p2_NF =   2.529e-12;
y_NF = p1_NF*NormalF0 + p2_NF;
figure
plot(NormalF0,y_NF,'r*')
grid on
title('NormalF0')
% ---------------4:Theta
theta_f0 = 2:0.1:40;
a_theta_f0 = 0.0002677;
b_theta_f0 = -0.1311;
c_theta_f0 = 0.0005681;
d_theta_f0 = -0.01049;
y_theta_f0 = a_theta_f0*exp(b_theta_f0*theta_f0) + c_theta_f0*exp(d_theta_f0*theta_f0);
%
figure
plot(theta_f0,y_theta_f0,'r*')
grid on
title('theta_f0')

Réponses (5)

Liu Yanping
Liu Yanping le 8 Août 2019

0 votes

Why there is NO answers.
Is it because the problem is not clear or because of the difficulty?
Daniel Taylor
Daniel Taylor le 29 Mar 2022

0 votes

Did you ever figure this out as i am currently having the same issue and using the regression forumlae and curve fitting toolbox aren't working

Catégories

En savoir plus sur Linear and Nonlinear Regression dans Centre d'aide et File Exchange

Produits

Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by