Matlab-nonlinear regression

33 views
Skip to first unread message

ahmed alqayssi

unread,
Oct 21, 2016, 1:49:37 PM10/21/16
to apmonitor
Greeting ..
I model my equation which consist of additional variable from another 2 equation as the text file with attachment
my target is to find the optimum value of variable "a" which must constrain between 0 and 1
the output regression plot is not consistence.
please any suggestion to solve this problem
Many thank and gratitude to professor John Hedengren  for continuous help and support

Kind Regard

Alqayssi
regression3.m
3-fitting plot.jpg
experimental data.xlsx
model3.apm

John Hedengren

unread,
Oct 21, 2016, 2:47:04 PM10/21/16
to apmo...@googlegroups.com

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.

regression_loop.zip

John Hedengren

unread,
Oct 21, 2016, 4:28:25 PM10/21/16
to apmo...@googlegroups.com

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

ahmed alqayssi

unread,
Oct 21, 2016, 7:22:25 PM10/21/16
to apmonitor, john_he...@byu.edu
Many thank to you support
it is really great help and the word not enough to express my thanks . Please professor the mean equation is very long and I have some mistake , I will rearrange it again .
please professor that mean the plot of objective function will defined the value of "a". please what can we do to get single value of "a" because it is crucial value.

Beast Regard

ahmed alqayssi

unread,
Oct 22, 2016, 9:07:35 AM10/22/16
to apmonitor
Greeting..
I make correction in some mistake in model equation . I really got reasonable value of target variable "a" but the problem in the fitting plot . if we change the target minimizing function in model to log scale is that will helpful to get butter plot fitting of mean equation and also the final plot in both axis in log scale. I hope to get any improvement in fitting
plot.

I record my deep sense of gratitude to your help

Beast Regard  
regression_loop5.m
regression5.m
model5.apm
fitting6.jpg
objective6.jpg

John Hedengren

unread,
Oct 24, 2016, 8:44:17 AM10/24/16
to apmo...@googlegroups.com

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>

--

regression_loop5.zip

ahmed alqayssi

unread,
Oct 24, 2016, 10:34:07 AM10/24/16
to apmonitor, john_he...@byu.edu

Thank you very much professor John Hedengren . You are really wonderful person, I hope you are got healthy and safety at all time .  
Reply all
Reply to author
Forward
0 new messages