Surface fit to determine the coefficients of a hypothetical equation
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dear all! As is mentioned in the title, I have to perform a surface fit to figure out coefficients of an analytical model. The equation describing the model in Matlab syntax is shown as follows:
JordanMdl=@(K,B,f) K(1).*(f./f0).*(B./B0).^2+K(2).*(f./f0).^2.*(B./B0).^2;
B,f are two inputs variables, whereas B0 and f0 are known constants. K(1),K(2) are the coefficients to be determined. In short, JordanMdl=f(B,f). I tried to use the built-in function lsqcurvefit, but one variable must be deactivated to let it run(e.g. f, and thus JordanMdl=f(B)), and the coefficients that were figured out differed greatly for different values of this deactivated variable. Apparently, curve fitting can only take one input while matching the random data points, and does not serve my purpose well. I wonder if there is any handy built-in functions/algorithum that can fulfill this purpose. Thanks a lot!
0 comentarios
Respuestas (1)
Star Strider
el 13 de Mayo de 2018
The easiest way to approach this is to create a separate matrix from ‘B’ and ‘f’, then pass that as your independent variable:
JordanMdlShell = @(K,Bf) JordanMdl(K,Bf(:,1),Bf(:,2));
where:
Bf = [B(:) f(:)];
This creates ‘Bf’ as an (Nx2) matrix. This also requires that your dependent variable becomes a column vector, for example: ‘Y(:)’. Change that if you want them as row vectors.
This should work with lsqcurvefit.
2 comentarios
Star Strider
el 14 de Mayo de 2018
You cannot use ‘Loss_1000Hz’ and ‘Loss_2500Hz’ in your model because they do not have the same lengths as your other data.
Alternatively, you can use all the columns, although using only rows 3 through 12 (so that B<=1).
Those are the only options that I see.
Good luck!
Ver también
Categorías
Más información sobre Mathematics and Optimization en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!