Problems in finding a set of global minima
Show older comments
Hi all, I have some problems in finding a set of local minimum of some complicated function. I use fminbnd but it only returns one single minium from the range of -50 to 50, but in fact there are 17 minima. How can I find the correct set of minima and save them into an array?
clear;
L=1;
L1=L/6;
omega0 = 0;
omegaR = 10;
tR= (2*pi)/omegaR;
te = 0.8;
t1 = 0;
t_i = te/50;
gamma_i = 1;
%alpha = (t_i^2)/(2*L);
alpha = (2*pi*gamma_i)/(omegaR*L) ;
beta = sqrt(1-te^2);
delta = sqrt(1-t1^2);
figure(1);
k = -54:0.01:54
a3 = (sqrt(1-te^2) - (te^2) ./ (1./(delta*exp(i*(k*L + i*alpha*L)) - (t1^2)*exp(i*( (k*L + i*alpha*L) + (k*L1 + i*alpha*L1) ))./(1- (sqrt(1-t1^2))*exp(i*(k*L1 + i*alpha*L1)))) - sqrt(1-te^2)));
a3norm = abs(a3);
plot(k,a3norm, 'LineWidth',1)
axis([-54 54 0 0.9 ])
xlabel('unnormalized m')
ylabel('T')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%% Finding Minimum %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
syms k;
k = fminbnd(@(k)abs((sqrt(1-te^2) - (te^2) ./ (1./(delta*exp(i*(k*L + i*alpha*L)) - (t1^2)*exp(i*( (k*L + i*alpha*L) + (k*L1 + i*alpha*L1) ))./(1- (sqrt(1-t1^2))*exp(i*(k*L1 + i*alpha*L1)))) - sqrt(1-te^2)))),-50,50)
Accepted Answer
More Answers (1)
L=1;
L1=L/6;
omega0 = 0;
omegaR = 10;
tR= (2*pi)/omegaR;
te = 0.8;
t1 = 0;
t_i = te/50;
gamma_i = 1;
%alpha = (t_i^2)/(2*L);
alpha = (2*pi*gamma_i)/(omegaR*L) ;
beta = sqrt(1-te^2);
delta = sqrt(1-t1^2);
syms k real
a3 = abs((sqrt(1-te^2) - (te^2) ./ (1./(delta*exp(i*(k*L + i*alpha*L)) - (t1^2)*exp(i*( (k*L + i*alpha*L) + (k*L1 + i*alpha*L1) ))./(1- (sqrt(1-t1^2))*exp(i*(k*L1 + i*alpha*L1)))) - sqrt(1-te^2))));
da3dk = diff(a3,k);
a3 = matlabFunction(a3);
da3dk = matlabFunction(da3dk);
k0 = -20*pi:2*pi:20*pi;
for i = 1:numel(k0)
kzero(i) = fzero(da3dk,[k0(i)-0.1 k0(i)+0.1]);
end
hold on
k = k0(1):0.01:k0(end);
%plot(k,da3dk(k))
%plot(kzero,da3dk(kzero),'o')
plot(k,a3(k))
plot(kzero,a3(kzero),'o')
hold off
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

