Hello, > De : Viktor Goryainov > Envoyé : mercredi 21 décembre 2016 16:43 > > I have a function that takes tabulated values from several arrays (a_w15, > b_w15, etc.) and thus returns a vector: > [...] > Now I need to [...] generate a vector
I'm not sure I understand well your problem with lsqrsolve(), but if you want to generate a vector, you should replace the if test by something like ---------- r = zeroes (dd); // initialization, not necessary but imho good practice ddboolean = (dd<0.25); r(ddboolean) = 0.319 * dd(ddboolean) / mu; r(~ddboolean) = (0.267 * dd(~ddboolean) + 0.013) / mu; ---------- So the whole function may look like: ---------- 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; r = zeroes (dd); ddboolean = (dd<0.25); r(ddboolean) = 0.319 * dd(ddboolean) / mu; r(~ddboolean) = (0.267 * dd(~ddboolean) + 0.013) / mu; endfunction ---------- Hope this helps -- Christophe Dang Ngoc Chan Mechanical calculation engineer This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. _______________________________________________ users mailing list [email protected] http://lists.scilab.org/mailman/listinfo/users
