Your objective function must return a scalar value but yours is returning a vector as your vector of design variables is a vector; the unchanged input. Consider your objective:
>> Objective = @(resid) resid; % Takes an input and returns it as the output.
>> Objective(1)
ans =
1
>> Objective([.2;.4;.04;.1;.02;2])
ans =
0.2000
0.4000
0.0400
0.1000
0.0200
2.0000
What is it you are truly trying to minimize? The norm of the vector perhaps?