Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Multstart stuck at initial point

1 vue (au cours des 30 derniers jours)
Sushant  Kumar
Sushant Kumar le 31 Mai 2013
Clôturé : MATLAB Answer Bot le 20 Août 2021
hi, i am using multstart to fit a sinusoid of unknown amplitude, frequency and phase(in this case vector f) with a noisy sinusoid(vector R). Here is what my objective function looks like...
function r5= myfunction5(N) global F1; F1 = 1001000; r = zeros(10000,1); f = zeros(10000,1); N = zeros(3,1);
for p = 1:10000
r(p,1) = 5 * sin(2*pi*F1*(p/(10000000))+0.3);
end
R = r + 0.1*randn(10000,1);
for q1 = 1:10000
f(q1,1) = N(1) * sin((2*pi*N(2)*(q1/10000000)) + N(3));
end
r5 = @(N)(R-f);
end
myfunction5 takes a vector input N and gives a vector output (R-f) of 1000*1 which i need to minimize. Here is how i called the objective function with a local solver lsqnonlin...
format long opts = optimset('Algorithm','trust-region-reflective','Display','iter','TolFun',1e-12,'TolX',1e-10);
problem = createOptimProblem('lsqnonlin','x0',[5;993000;0.1],'objective',myfunction5,'lb',[4.8 989000 0.2],'ub',[5.2 1011000 0.4],...
'options',opts);
ms = MultiStart;
[N,fval,exitflag,output,solutions] = run(ms,problem,49);
it keeps on displaying whatever starting point i pass in the problem structure as the optimal point output independent of watever F1 is chosen in myfunction5.
i am particularly interested in N(2) which should come out to be equal to F1. Changing the initial point displays the same initial point being used everytime in the code as the optimal point. Plz help!

Réponses (0)

Cette question est clôturée.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by