How to write a Matlab code for a sequence of functionals and their minimums

Let A(α) be a matrix (N ,N) depending on a real parameter α ( α ∈ I_α ) and (f_k )_(k≥1) a sequence of vectors in R^N.
We note by u a vector in R^N. We define the following functional sequence
J_k (α)=‖A(α) f_k - u‖^2 (norme square)
and the sequence of minimums
α_(k+1)=min (J_k) for α ∈ I_α
The vector f_1 and the number α_1 are given. We suppose that k varies from 1 to L with L≥1
Question∶How to write the Matlab code corresponding to the J_k and α_(k+1) sequences ?

6 commentaires

Is u given or unknown, too ?
And the f_k are also given or unknown ?
The sequence f_k is defined by a reccurence relation.
Torsten
Torsten le 3 Avr 2024
Modifié(e) : Torsten le 3 Avr 2024
And on what does this recurrence relation depend ? On f_(k-1),...,f_(k-m) ? On alpha_k ? On the optimal alpha-values of the preceding problems solved alpha_opt_(k-1),...,alpha_opt_(k-m) ?
In this relation, f_k+1 depends on f_k and the matrix A(α_k). By giving f_1 and α_1, the vectors f_k are all well defined.

Connectez-vous pour commenter.

 Réponse acceptée

Torsten
Torsten le 3 Avr 2024
Modifié(e) : Torsten le 3 Avr 2024
Your code:
number_of_iterations = 3;
A = @(alpha) ...; % Your NxN matrix A depending on alpha
u = ...; % Your Nx1 vector u
f(:,1) = ...; % Your initial Nx1 vector f
alpha0 = ...; % Your initial guess for alpha_opt(1)
for i = 1:number_of_iterations
fun = @(alpha) (A(alpha)*f(:,i)-u).'*(A(alpha)*f(:,i)-u);
[alpha_opt(i),~,exitflag,output] = fminunc(fun,alpha0);
f(:,i+1) = ...; function of A(alpha_opt(i)) and f(:,i) - your recurrence relation
alpha0 = alpha_opt(i);
end

5 commentaires

Thanks a lot for the Matlab code..It works well. There is just one small detail left. The alpha parameter is in a determined interval.This is interval I.But this does not appear in the code. So for a small number of iterations, we obtain some minimum values ​​which are not in the interval I. How to add the constraint of belonging to the interval I in the code ?
Does "fminbnd" work for you instead of "fminunc" ?
If not, use "fmincon" with lower and upper bounds lb and ub for the parameter.
If we use fminbnd, what happens for alpha0 ?
Seems fminbnd does not need an initial guess. You only need to specify start and end point of I (assuming I is finite).
I used fminbnd and it worked. Thank you so much.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Encryption / Cryptography dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by