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
2020년 4월 27일
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)
