[Scilab-users] Using lsqrsolve with a certain kind of function

Viktor Goryainov al_exquemelin at yahoo.com
Wed Dec 21 16:43:28 CET 2016


Hello,


I have a function that takes tabulated values from several arrays 
(a_w15, b_w15, etc.) and thus returns a vector:


function r = vr3(C, mu)
  a = a_w15 + a_chl15 * C(1) + a_sm15 * C(2) + a_doc15 * C(3);
  bb = b_w15 + b_chl15 * C(1) + b_sm15 * C(2);
  dd = bb ./ a;


  if dd < 0.25 then
   r = 0.319 * dd / mu;
  else
   r = (0.267 * dd + 0.013) / mu;
  end
endfunction

Now I need to use it twice in my task: first to generate a vector for 
some C_inh, then to try and restore C_inh from an initial guess C_init 
using lsqrsolve. How should I modify the vr3 to achieve this?

Best regards,
Viktor



More information about the users mailing list