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?
采纳的回答
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 的更多信息
产品
标签
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
