Data fitting using Linear Programming function
2 views (last 30 days)
Show older comments
Hello Everyone
I am new here, i had a question regarding linprog function. here is the description of the problem, below that is my attemtped code, please take a look at it, the problem i have is the constraint ap2 which should be 1.5, but putting it in a matrix form that would make the algorith work.
Now the reason i am here, is to seek assistance with this problem
suppose you want to fit the data set { tau(t); I(t); B(t)} available in the workspace, with the model
τau(t) = q1.(I^q2).(B^q3)
- Reformulate the problem as a linear optimization one and introducethe constraints α2 < 0, α3 = 1.5 (Hint: transform the data using ln).
- Write the corresponding Scilab algorithm using linpro
%Suppose we have the data {tau,I, B}
%initial values of the parameters, the parameters to be found
ap1=0.5;
ap2=-1;
ap3=1;
%the model equation Tau=ap1*(I^ap2)*(B^ap3);
% linearize by log
log(tau)=Y;
lap=log(ap1);
Y= lap+ap2*log(I)+ap3*log(B)
% the constraints are ap2<0; ap3=1.5;
%the objective c= Y-log(ap1)+ap2*log(I)+ap 3*log(B)
c=[1;log(I);log(B)] % linprog solves minimization problems
%alpha < 0
ub= zeros(2);
xsol=linprog(c,[],[],[],[],ub);
how can i otherwise approach the problem if my method isn't right.
Thank you a lot folks
0 Comments
Answers (1)
See Also
Categories
Find more on Analyze Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!