String n = size(x); it doesnβt make sense if you want the number of elements in n ( size returns the dimension row vector, not the scalar). Instead, try n=numel(x); .
Later editing: I also see that you highlight the output as follows: out_l = zeros(n); , but you should know that it creates an nxn matrix, not an array, as you might expect. Try out_l = zeros(1,n); for change.
And one more tip: if in doubt, use the F1 key as often as possible. :-) The Matlab Integrated Help explains Matlab very well.
user2271770
source share