If you know the form of the function that you want to place but don’t know its parameters, you can use fminsearchit to find the parameters that match your data. If you have data (possibly noisy) that you want to put in y=x^a + b, where aand bare unknown (here I'm going to assume that the true values are a=1/3and b=5) d quick answer:
Here I generate my data (you did not need to do this in real life)
>> x = linspace(0,5,10);
>> y = x.^(1/3) + 5;
>> y_noisy = y + 0.1*rand(size(y));
, a b, fminsearch. , . : . , a b.
NB: fminsearch wotks (v ). a=v(1) b=v(2). v ( [1 1]).
>> err_noisy = @(v) trapz(x,(y_noisy - x.^v(1)-v(2)).^2);
>> err = @(v) trapz(x,(y - x.^v(1)-v(2)).^2);
>> v_noisy = fminsearch(err_noisy,[1 1])
v_noisy =
0.3345 5.0594
>> v = fminsearch(err,[1 1])
v =
0.3333 5.0000
, , a b, . , , a>0, log(a), a.
, .
.