Hi
I want to obtained fitting function Delta_n = f(width,gap, thick). I have run the EM simulation of particular device and obtained the value of Delta_n by varying width, gap and thickness. There is no mathematical model that I can use to fit. The data directily came from EM simulations. I have attached the data in case you want to look into it. The data contain three vectors width_j (1x11), gap_i (1x11) and thick_k (1x10), I have stored the value of Delta_n (11 x 11 x 10) using three nested loop as shown below.
delta_n = matrix (length(gap_i),length(width_j),length(thick_k));
for (kk=1:length(thick_k))
{
for (ii=1:length(gap_i))
{
for(jj=1:length(width_j))
{
delta_n(ii,jj,kk) = EM Simulation (width_i(jj), gap_j(ii), thick_k(kk)) % I have used third party EM simulator here.
}}}
I have gone through several MATLAB answer mostly recommends to use scatteredInterpolant or polyfitn. But here I think is the problem data arrangement. Can anyone please help to obtained the fitting function delta_n=f(width,gap,thick)? I can't use cftool interactive app as it only supports only 2D fucntions.

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 16일

0 개 추천

You first need to create a grid from the three input variables and then apply scatteredInterpolant
[W, G, T] = ndgrid(width_j, gap_i, thick_k);
Model = scatteredInterpolant(W(:), G(:), T(:), delta_n(:))

댓글 수: 5

Abi Waqas
Abi Waqas 2020년 5월 17일
Dear Ameer Hamza
Thank you so much for the response. I really appreciate the help.
The code seems to working. How can I extract the fittting function from it? As I have to use it do further simulation in 3rd party software. Or I can only use it in MATLAB by storing the Model and re-load it every time? Is there any other way to build the function out of it that I can use it every time?
Ameer Hamza
Ameer Hamza 2020년 5월 17일
I don't think that there is a method to get an equation from it. In fact, it does not even fit a single surface. It uses local interpolation by using neighboring points. The documentation page refers to a research paper, and you may need to study that to see how scatteredInterpolant works.
Ameer Hamza
Ameer Hamza 2020년 5월 17일
It also does not support code generation, so it seems that Mathworks does not intend it to be interfaced with other software. If you want a closed-form expression, then you need to use the Curve-Fitting toolbox.
Abi Waqas
Abi Waqas 2020년 5월 17일
cftool box doesn't not support to fit 3D data. It only works upto 2D data.
Ameer Hamza
Ameer Hamza 2020년 5월 17일
yes, cftool does not support more than two independent variables, but you can programmatically call fit() function. There is no restriction on the number of independent variables.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

제품

질문:

2020년 5월 16일

댓글:

2020년 5월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by