Linprog: No feasible solution found.
3 次查看(过去 30 天)
显示 更早的评论
clc ;
clear all ;
close all ;
% N = input('Tell me the length N: ' );
N = 25;
K = N + 1 ;
w4 = linspace( 0 , pi , 10*K );
idx = (w4 > 0.4*pi) & (w4 < 0.5*pi );
w4(idx) = [];
w4 = sort(w4);
w4 = w4';
D1= ones( 2*length(w4),1);
W1= ones( 2*length(w4),1);
for i = 1:1:length(w4)
if w4(i)>= 0.4*pi
h = 2*i;
break;
end
end
for i = 2:2:length(w4)
D1(i)= -1;
end
for h = h:length(D1)
D1(h)= 0;
W1(h) = 2;
end
for i = 2:2:2*length(w4)
W1(i)= -1*W1(i);
end
y1 = zeros( length(D1) , K+1);
for i = 1:1:length(w4)
for j = 1:1:K+1
y1(2*i-1,j) = 2*cos((j-1)*w4(i));
y1(2*i-1,1) = 1;
y1(2*i,j) = -2*cos((j-1)*w4(i));
y1(2*i,1) = -1;
y1(2*i-1,K+1) = 1/W1(2*i);
y1(2*i,K+1) = -1/W1(2*i);
end
end
f = zeros( 1,K+1);
f(:,K+1)=1;
y2 = zeros( 1 , K+1);
for i = 1:1:K+1
y2(i)=2*cos((i-1)*0.45*pi);
y2(1) = 1;
y2(K+1) = 0;
end
d1 = 0.5;
X= linprog(f,y1,D1,y2,d1);
I have these arrays for inequality ( yi , D1 ) and this for equality ( y2 , d1 ) and the (f) from x*f'.
What am i doing wrong with the linprog command?
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!