Ahmed,
Here is a plot of your objective function versus the value of “a”. You can see that it is very nonlinear and also convex (two local minima at about 0.25 and 1.0).
With only one variable (a) you can try all values and see which one fits best. In this case, no value of “a” helps the model fit very well. I recommend that you revisit your equations to verify that you have the correct form. Also, you don’t need the variable “z”.
Best regards,
John Hedengren
--
--
APMonitor user's group e-mail list.
- To post a message, send email to apmo...@googlegroups.com
- To unsubscribe, send email to
apmonitor+...@googlegroups.com
- Visit this group at http://groups.google.com/group/apmonitor
---
You received this message because you are subscribed to the Google Groups "apmonitor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
apmonitor+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ahmed,
I meant to say “non-convex”. The optimizer may reach a different local minimum based on the starting guess value. If it starts <= 0.5 then it will likely converge to 0.25. If it starts >0.5 then it will likely reach an optimal value of 1.0 (upper bound).
Best regards,
John Hedengren
Alqayssi,
You can take the best guess value from the guesses to re-optimize. I added the following code:
% take the lowest objective value and optimize at that starting point
[obj_min,imin] = min(obj);
apm_option(s,a,'a.status',1);
apm_meas(s,a,'a',aval(imin));
output = apm(s,a,'solve');
% retrieve solution
y = apm_sol(s,a);
z = y.x;
% record objective function
best_obj = apm_tag(s,a,'nlc.objfcnval');
% print solution
disp(['a= ' num2str(z.a(1)) ' with objective: ' num2str(best_obj)])
%plot solution
figure(3)
plot(z.xm,z.ym,'O');
hold on
plot(z.xm,z.y,'*');
xlabel('shear rate [1/s]')
ylabel('viscosity[Pa.s]')
legend('experimental data ','simulated ')
You won’t be able to get a better numerical solution unless you find another error in your equations or else relax (enlarge) some of the bounds.
Best regards,
John Hedengren
From: apmo...@googlegroups.com [mailto:apmo...@googlegroups.com] On Behalf Of ahmed alqayssi
Sent: Friday, October 21, 2016 6:34 PM
To: apmonitor <apmo...@googlegroups.com>
--