Thanks for your help! Your command works for me too. The problem seems to be in how I call a predefined function. So the function handle @KK in the test example below must be wrong. In the real script I use a very large, complex function that I cannot add directly in the leasqr command. That’s why I need to call the function name.
time = [1;2;3;4;5];
abs = [5; 5; 5; 5; 5]+randn([5 1])/10;
v = [2; 2];
function S = KK(time, v)
S = time*v(1)+v(2);