Optimization problem using Quasi Newton method

2 visualizzazioni (ultimi 30 giorni)
christina
christina il 24 Giu 2018
Commentato: christina il 25 Giu 2018
Given x_t and c_mn, the objective function is defined as:
I am trying to solve the above objective function for theta using quasi newton method. But there seem to be some problem with my code as it's not working. Could somebody please help me with this?
Following is my matlab code:
Code for defining objective function:
function f = objfuntc(x_t,c_mn,theta )
L = length(x_t );
[M,N] =size(c_mn);
f = 0 ;
for t = 1:L
xs = 0 ;
for n = 1:N
for m=1:M
xs = xs + c_mn(m,n)*exp(1i*2*pi*m*(t - n -2) + theta);
end
end
f = f + (x_t(t) - xs)^2 ;
end
Code for calling objective function:
x_t = rand(16,1 );
L = length(x_t);
a = 1;
M = L;
c = rand(M*L/a,1 );
c_mn=reshape(c,[M,L/a]);
J = @(theta) objfuntc(x_t,c_mn,theta )
theta0 = 10 ;
options = optimoptions('fminunc','Algorithm','quasi-newton ');
[theta, thetaval] = fminunc(J,theta0,options)
  12 Commenti
Torsten
Torsten il 25 Giu 2018
I complemented my comment.
christina
christina il 25 Giu 2018
Thank you so much! That fixed everything.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Get Started with Optimization Toolbox in Help Center e File Exchange

Prodotti


Release

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by