我的主程式可以求得我空間節點分布關係的矩陣
接著求出這個矩陣的次小特徵值
然後這個主程式的變量為一個X的座標向量
現在想要用fmincon的工具求出我X的擺放位置
來使我的次小特徵值可以達到最大
我的主程式如下
clc
clear all
A=[];
b=[];
x0=[0;0;0]
X = fmincon(@myfun,x0,A,b)
然後這是myfun的內容
f=myfun(X)
.
.
.
.
輸入X會得出一個L矩陣
[V,Eig]=eig(L);
f=-Eig(2,2); %這個為我想要讓他得到最大值的解 因要求最大解所以有加負號
end
雖然可以成功執行
但是找出來的X值都會是我設定的x0
Command Window內沒有看到他去做迭代的過程
直接顯示
Optimization completed because at the initial point, the objective function
is non-decreasing
in feasible directions to within the default value of the optimality
tolerance, and
constraints are satisfied to within the default value of the constraint
tolerance.
麻煩懂這個工具的高手拯救一下了!