I have a multivariate power equation in the form y = a1 * (x1^a2) * (x2^a3) * (x3^a4) * (x4^a5) * (x5^a6) , where I have an array of values for each x-term and for the y-term that are each 19775×1. I need to determine the values for the constants a1, a2, a3, a4, and a5 and was told to use a linear solve of logarithmic transformations which minimize the sum of the residual squares. Is there a way to do this in MATLAB?
Attached is my code that I have thus far:
%% Non-dimensional empirical model
% fit used to create correlation:
% pi_theta = a1 .* (pi_y).^a2 .* (pi_z).^a3 .* (pi_twp).^a4 .* ...
% (pi_tcb).^a5 .* (pi_alpha_cb).^a6;
% log10(pi_theta) = log10(a1) + a2 * log10(pi_y) + a3 * log10(pi_z)...
% + a4 * log10(pi_twp) + a5 * log10(pi_tcb) + a6 * log10(pi_alpha_cb);
% solve constants using linear solve of logarithmic transformations of
% above equation.
% a1 =
% a2 =
% a3 =
% a4 =
% a5 =
% a6 =
X = [ones(size(pi_y)), log10(pi_y), log10(pi_z), log10(pi_twp), ... log10(pi_tcb), log10(pi_alpha_cb)];Y = log10(pi_theta);[b, bint,r,rint,stats] = mvregress(Y,X);
I keep getting this error, though:
Error using mvregress (line 456)Covariance is not positive-definite.Error in Dimensionless_parameters_analysis (line 266)[b, bint,r,rint,stats] = mvregress(Y,X);
Best Answer