how to write a constraint file for an optimization problem for which independent variable is a matrix?
Afficher commentaires plus anciens
function j= costfunction(x,As)
% s1 reads .wav file recorded from first microphone at 16 kHz
[x1, Fs, bits_per_sample]=wavread('E:\speech matlab\X1_linear.wav');
% s2 reads .wav file recorded from second microphone at 16 kHz
[x2, Fs, bits_per_sample]=wavread('E:\speech matlab\X2_linear.wav');
L=length(x1);
m=[x1(1:2:L) x2(1:2:L)]';
for k=1:size(m,2)
Rx=(m(:,k)*m(:,k)');
%d=diag(Rx);
%e=Rx-[d(1,1) 0;0 d(2,1)];
e=Rx-x*As*x;
sum=0;
j=sum+(trace(e*e'))^2;
end
this is my objective function file in which x and As are 2x2 matrices. optimization has to be done with respect to x and i am passing As from command window using anonymous function. now i want to have diagonal elements of x(x11 and x22) equal to 1 as constraints. how can i do that? what if i want to optimize with respect to x and As both?
thanx in advance...
Réponse acceptée
Plus de réponses (1)
Alan Weiss
le 22 Oct 2013
0 votes
There is a little bit of documentation on this subject. I don't know if it is enough to help you, but you might want to take a look.
Alan Weiss
MATLAB mathematical toolbox documentation
Catégories
En savoir plus sur Choose a Solver 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!