Question about fminunc function (iteration problem)

3 views (last 30 days)
Hi,
I am trying to perform iterations on function f with variable 'Lb'. The code works fine but does not proceed to iterations. It says the initial value already reaches the minimum value.
[Lb,fval] = fminunc('myfunsdfsd', Lb1, options);
(Lb1 states the initial value.. 15000)
The answer should be 15000, 14800, 14560, and until it reaches 0. But I only get 15000, 15000, 15000, ...and so on.
Is there any way to make the function iterate?
f = sum(delPi1 - (delPmi + 12*mu*Lb/Wb/(H^3)*(1-(192/(pi^5)*H/Wb*tanh(pi*Wb/2/H)))^(-1) + Qb))^2;
This is function I am trying to minimize.
I have defined the other variables except Lb. I made Lb as symbolic function as well. Is that why it doesnt iterate?
Thank you in advance!!

Accepted Answer

Torsten
Torsten on 20 Jul 2015
Yes, fminunc does not work with symbolic variables.
Best wishes
Torsten.
  4 Comments
Emily
Emily on 22 Jul 2015
Edited: Walter Roberson on 22 Jul 2015
Yes you are right.
I am just verifying the excel data so I don't have them in mathematical notation. To clarify, the objective function is the sum error of pressure drops for each length (Lb).
So does the code seem to make sense so far?
I added another for loop for Lb(Lb's lower bound:0, upper bound:16800)
for x=2:48
Qb(x) = ((Q - sum(Qb(x-1:1))) * x1)/(1+x1);
for Lb=0:16800
Rb(x) = 12*mu*Lb1/Wb/(H^3)*(1-(192/(pi^5)*H/Wb*tanh(pi*Wb/2/H)))^(-1);
end
delPmi(x) = delPmi(x-1) + Rmi1*(Q-sum(Qb(x-1:1)));
delPb(x) = Rb(x) + Qb(x);
delPi(x) = delPmi(x) + delPb(x);
end
Torsten
Torsten on 22 Jul 2015
To be honest: I don't understand what you are trying to do.
So more information about the background of your problem and about the above calculations is needed in order to help.
Sorry.
Best wishes
Torsten.

Sign in to comment.

More Answers (0)

Categories

Find more on Equations in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!