Need to calculate 12 experimental coefficients highlighted in red. Have found F'n and F't values with 200 samples, and all other values like Vw, Vc, a, de, Cs are known.

1 次查看(过去 30 天)
I need to calculate experimental coefficients K, K1, K4, a0, b0, c0 using F'n 200 sample experimental values. Similarly K', K2, K3, a0, b0, c0 to be calculated using F't 200 sample experimental values. Note that Vw, Vc, a, de, Cs values are known for 200 sample values. Please help in with this matlab program.

回答(1 个)

SAI SRUJAN
SAI SRUJAN 2024-4-30
Hi Muralidhar,
I understand that you are trying to calculate 12 experimental coefficients from a set of 200 samples.
As the model for relating ('F'n') and ('F't') to the coefficients and variables '((V_w), (V_c), (a), (de), (Cs))' is complex, using 'fmincon' from MATLAB's Optimization Toolbox is a suitable approach.'fmincon' is used for finding the minimum of a constrained multivariable function.
The general approach involves defining an objective function that calculates the sum of squared errors (SSE) between the experimental values and the values predicted by the model(F'n and F't). Then, 'fmincon' is used to find the set of coefficients that minimizes this SSE.
Please go through the following code sample to proceed further,
function [sse] = objectiveFunction(coeffs, Vw, Vc, a, de, Cs, F)
% coeffs are the coefficients (define these for the unknown variables)
F_pred = coeffs(1)*Vw + coeffs(2)*Vc + coeffs(3)*a + coeffs(4)*de + coeffs(5)*Cs + coeffs(6); % This is just an example model
sse = sum((F - F_pred).^2);
end
initialGuess = zeros(6, 1);
% Bounds and constraints (if you have any, otherwise set these to [])
A = []; b = [];
Aeq = []; beq = [];
lb = []; % Lower bounds of coefficients
ub = []; % Upper bounds of coefficients
nonlcon = []; % Non-linear constraints
% For F'n
options = optimoptions('fmincon', 'Display', 'iter', 'Algorithm', 'sqp');
[coeffs_Fn, sse_Fn] = fmincon(@(coeffs)objectiveFunction(coeffs, Vw, Vc, a, de, Cs, Fn), initialGuess, A, b, Aeq, beq, lb, ub, nonlcon, options);
The initial guess, bounds, and constraints ('initialGuess', 'lb', 'ub', etc.) are crucial to finding a good solution with 'fmincon'.With this approach, we can find the set of coefficients that best fit the experimental data by minimizing the error between the predicted and actual values.
For a comprehensive understanding of the 'fmincon' MATLAB function, please go through the following documentation.
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Least Squares 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by