how to retrieve 3 parameters by fitting data into a model

I have a data set of surface impedance of a material. I need to retrieve 3 parameters from a model by fitting this data into it. I have no previous experience in Matlab. can i get any suggestions and explanations on how to go about it?

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 27일

0 개 추천

See fit(): https://www.mathworks.com/help/releases/R2020a/curvefit/fit.html from curve fitting toolbox and https://www.mathworks.com/help/releases/R2020a/optim/ug/lsqcurvefit.html from optimization toolbox. For a specific suggestion, share the equation of your mathematical model.

댓글 수: 11

please look at this equation sheet.
These equations look quite complicated. You need to write these in MATLAB format before trying to estimate the parameters.
x = 0.001; %porosity
s = 001; % mean pore size
y = 0.001;% standard deviation
w = 127; % frequency (input from data sheet)
theta1 = (1/3);
theta2 = exp((-1/2)*((y*log2)^2))/sqrt(2); %theta values
theta3 = theta1/theta2;
rhozero = 1.225; %ambient density of air
alpha = exp(4*(y*log2)^2); %tortosity
eta = 1.81e-5; %dynamic viscosity of air
sigma = (((8*eta*alpha)/((s^2)*x)))* (exp(6*(y*log2)^2)); %bulk flow resistivity
epsilonp = sqrt((-(w*rhozero*alpha)i)/(x*sigma));
fp = (1+ (theta3*epsilonp)+(theta1*epsilonp))/(1+(theta3*epsilonp));
%substituting to main equation part 1
pw = ((rhozero*alpha)/(x))*((1+(epsilonp)^-2)*fp); %p omega
gamma = 1.4; %specific heat ratio
thetab = exp((3/2)*((y*log2)^2));
thetac = theta1/thetab;
sigma1 = (((8*eta*alpha)/((s^2)*x)))* (exp(-6*(y*log2)^2));
npr = 0.71; %prandtl number of air
epsilonc = sqrt((-(w*rhozero*npr*alpha)i)/(x*sigma1));
fc = (1+(thetac*epsilonc)+(theta1*epsilonc))/(1+(thetac*epsilonc));
po = 1.013e5; %ambient atmospheric pressure
cw = (x/(gamma*po))*(gamma-((gamma-1)/(1+((epsilonc)^-2)*fc); %c omega
%equations
zb = sqrt(pw/cw);
kb = (w* sqrt(pw*cw));
h = 50; % thickness of sample
czero = 343; %speed of sound m/s
%main equation
z = (zb * coth((-(kb*h)i)/(rhozero * czero)));
x0 = [x,s,y];
m = fminsearch(z,x0);
i want to use fminsearch on function z to retrieve the paramters porosity, mean pore size and standard deviation. i have given them initial values. could you check if the syntax for fminsearch is correct?
You need to write an objective function to use fminsearch. What is your equation?
z = (zb * coth((-(kb*h)i)/(rhozero * czero)))
this is my equation.
You need to write a separate function that takes the value of x, s, and y as input and output the value of z. Just take your code and encapsulate it into a function.
so i need to expand this equation just in terms of x,s and y as input? just defining them like i did at the start of the coding won't work?
No. You need to write a separate function. fminsearch needs a function handle. You just need to write the function in which value of x, s and y are not pre-defined. The function takes these values as input and returns the value of 'z'.
i have a set of data for z which i got from experimients. i need a tool that will run these equations and iterate values for x,s and y until i get the closest value of z. is this possible using fminsearch?
ie the tool should give me the closest theoretical z to experimental z and the respectives values of x,s and y at that point.
In that case, you will need to use lsqcurvefit() instead of fminsearch. In any case, you need to write it into a function of the variables you are trying to estimate. Something like this
function z = myModel(z,s,z)
% you code to calculate z
z = .. % value of z
end
okay thank you very much. i will try it out and get back to you

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Optimization Toolbox에 대해 자세히 알아보기

제품

태그

질문:

2020년 4월 27일

댓글:

2020년 5월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by