I want to minimaze with the arrays that follow with the command linprog.
1 view (last 30 days)
Show older comments
Hello, what should i choose for f array if my y1=A and D1=b ( I want only for inequality ).
clc ;
clear all ;
close all ;
% % N = input('Tell me the length N: ' );
N = 25;
K = N + 1 ;
w = linspace( 0 , pi , 10*K);
w=w';
D1= ones( 2*length(w),1);
W1= ones( 2*length(w),1);
for i = 1:1:length(w)
if w(i)>= 0.4*pi
h = 2*i;
break;
end
end
for i = 2:2:length(w)
D1(i)= -1;
end
for h = h:length(D1)
D1(h)= 0;
W1(h) = 2;
end
% for i = 2:2:2*length(w3)
% W1(i)= -1*W1(i);
% end
y1 = zeros( length(D1) , K+1);
for i = 1:1:length(w)
for j = 1:1:K+1
y1(2*i-1,j) = 2*cos((j-1)*w(i));
y1(2*i-1,1) = 1;
y1(2*i,j) = -2*cos((j-1)*w(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
D1 = D1';
f = ones( 1 , K+1);
% f(:,K+1)=1;
X = linprog(f,y1,D1)
1 Comment
Matt J
on 10 Dec 2020
It looks like your code runs and produces a solution. What are we supposed to see as a difficulty in what you've posted?
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!