function [y,no] = f2(x,ni) x = x(:); ni = ni(:); np = length(x); if length(x) ~= length(ni) disp 'error: vectors not same length' return end y = [x.*ni; 0; 0]'; no = [min(ni):min(ni)+np+1];