フィルターのクリア

fminsearch, linear programme - reg

1 回表示 (過去 30 日間)
Kallam Haranadha Reddy
Kallam Haranadha Reddy 2018 年 11 月 11 日
回答済み: Walter Roberson 2018 年 11 月 11 日
I wrote the following function 'fun_phi1'; I called this function as follows
fun=@(y) fun_phi1(y);
>> z=fminsearch(fun,zeros(1,200));
it is showing the message 'optimization terminated' infinitely. the message is not stopping.
please correct the mistake in coding.
function [ fval ] = fun_phi1(y)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
f1=zeros(1,100);
f2=zeros(1,100);
c1=randi([1,20],1,100);
c2=randi([1,20],1,100);
f1(1,1:100)=[y(1:100).*c1];
f2(1,1:100)=[y(101:200).*c2];
lb=zeros(1,100);
ub=5*ones(1,100);
%fun=@(x1,x2)(f1+f2);
x10=zeros(1,100);
x11=zeros(1,100);
% f1=@(y)(c1*y(1:100));
% f2=@(y)(c2*y(101:200));
[x1,fval1]=linprog(f1,[],[],[],[],lb,ub);
[x2,fval2]=linprog(f2,[],[],[],[],lb,ub);
fval=fval1+fval2;
end

採用された回答

Walter Roberson
Walter Roberson 2018 年 11 月 11 日
When you call linprog make sure you pass in an options structure that specifies 'Display', 'none'

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

製品


リリース

R2015b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by