Clear Filters
Clear Filters

Error minimization by optimizing the parameter value using fminunc

1 view (last 30 days)
function obj = objFunction(q)
data=readtable('solu6_deleted few rows VALUE-Mat1');
A=table2array(data);
size(A)
TF1 = A(:,32)<=0.0001;
A(TF1,:) = [];
size(A)
TF2 = A(:,2)<=0.0001;
A(TF2,:) = [];
size(A)
yex=A(:,33);
x1=A(:,1);
x2=A(:,2);
f1=A(:,4);
f2=A(:,5);
T=A(:,3);
size(T)
yp=@prediction;
obj=norm(yex(':') - yp(':')).^2 ;
---------------------------------------------------
function yp = prediction(q,f1,f2,x1,x2,T)
% Unknown parameter
Q1=q(1);
Q2=q(2);
Q3=q(3);
yp=f1.*log(x1)+f2.*log(x2)+(Q1+Q2.*(f1-f2)+Q3.*(f1-f2).^2).*f1.*f2.*T./298;
what is the wrong with this code ..can anyone please help me ,if any additional info required i will share.
Basically i want to minimize the obj value by optimizing the Q1,Q2,Q3 value using fminunc.
please help me i am new to this software.
  3 Comments
DURGA PRAJAPATI
DURGA PRAJAPATI on 7 Sep 2021
Thankyou for your reply.
Actually there was problem in calling the function .But I have resolved .

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!