Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% model function:
- F = @ (x, p) p(1) * exp (p(2) * x);
- %% independents and dependents:
- x = 1:5;
- y = [1, 2, 4, 7, 14];
- %% initial values:
- init = [.25; .25];
- %% other configuration (default values):
- tolerance = .0001;
- max_iterations = 20;
- weights = ones (1, 5);
- dp = [.001; .001]; % bidirectional numeric gradient stepsize
- dFdp = "dfdp"; % function for gradient (numerical)
- %% linear constraints, A.' * parametervector + B >= 0
- A = [1; -1]; B = 0; % p(1) >= p(2);
- options.inequc = {A, B};
- %% start leasqr, be sure that 'verbose' is not set
- global verbose; verbose = false;
- [f, p, cvg, iter] = ...
- leasqr (x, y, init, F, tolerance, max_iterations, ...
- weights, dp, dFdp, options)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement