<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">the example I built is not relevant and it does not reflect the problem behind... sorry for the inconvenient</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Paul</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Le 2017-04-18 17:20, <a href="mailto:roger.cormier@ncf.ca">roger.cormier@ncf.ca</a> a écrit :
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">Paul:<br /> <br /> It appears that you're solving for y given theta and x, but y is a<br /> linear function of theta and x.<br /> <br /> I don't have a good knowledge of what you are trying to solve, but<br /> when I solve nonlinear problems I normally either have a form of<br /> first-order derivative (scalar or a Jacobian), or some form of<br /> branching/discontinuity from which I need to choose the "best"<br /> solution. For linear interpolation, I find that it's easier to simply<br /> write a function myself than try to figure out how to make a given<br /> built-in function works.<br /> <br /> I'm going fishing here: in your function, theta is 8x1 but your<br /> arguments for interpl are theta(:,1),theta(:,2), which presumes that<br /> theta is 8x2, so that could be a place to start looking at why fsolve<br /> is giving your grief.<br /> <br /> Regards,<br /> <br /> <br /> Roger.<br /> <br /> ______________________________________________<br /> Dr. Roger Cormier, P.Eng.<br /> Home Tel. & Fax: 613-823-7299<br /> <br /> <br /> Am mar. 18 avr. 2017 um 09:03 schrieb <a href="mailto:paul.carrico@free.fr:">paul.carrico@free.fr:</a><br /> <br />
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">Hi All<br /> <br /> I'm wondering what is the way to solve the following study (but at the same time I'm not sure that the problem has been correctly posed) ... I'm a bit "disrupted" by theta scalar that depends itself on x value.<br /> <br /> The problem seems to be non linear and I tried (but I failed) in using fsolve.<br /> <br /> Any suggestion where I've to see to?<br /> <br /> Thanks for your time and help<br /> <br /> Paul<br /> <br /> <br /> <br /> #################################################<br /> function y=calculus(x)<br /> <br /> <br /> theta = [ 1 100 200 300<br /> <br /> <br /> 1000 1200 1500 2000]';<br /> <br /> <br /> <br /> theta_interp = interp1(theta(:,1),theta(:,2),x,'linear');<br /> <br /> <br /> y = -theta_interp * 0.268 + 120 -x; //pause<br /> <br /> <br /> <br /> // if theta = 1 : y = 0 -> x = 120 - 0.268 = 119.73<br /> <br /> <br /> // if theta = 100 : y = 0 -> x = 120 - 26.8 = 93.2<br /> <br /> <br /> // if theta = 200 : x = 66.4<br /> <br /> <br /> // if theta = 300 : x = 120 - 0.268 = 39.6<br /> <br /> <br /> <br /> // can we say that y belongs to [39.6 , 119.73] ?<br /> <br /> <br /> <br /> endfunction<br /> <br /> <br /> <br /> [x,v,info] = fsolve(0,calculus)<br /> <br /> <br /> <br /> _______________________________________________<br /> users mailing list<br /> <a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br /> <a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank" rel="noreferrer">http://lists.scilab.org/mailman/listinfo/users</a></blockquote>
<br /> _______________________________________________<br /> users mailing list<br /> <a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br /> <a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank" rel="noreferrer">http://lists.scilab.org/mailman/listinfo/users</a></blockquote>
</div>
</body></html>