MATLAB is not responding

Hello everybody, I am a beginner in Matlab and I have a problem with optimization using fmincon. I use an objective function file, a (non linear) constraints file and a script file which contains the fmincon function. When I run the last file Matlab's not responding.
These are the codes, thank you
*objective function file:*
function [ C ] = objparadeigma4(var)
% αντικειμενική συνάρτηση του προβλήματος 4
L=30;
V=80;
D=var(1);
W=var(2);
C= 255*L+137*L*D^1.5+55500*W^0.5+10500*W^0.925+17000;
% Δεν καταλαβαίνει τη μεταβλητή W, μάλλον επειδή δεν ξέρει μέχρι στιγμής το
% D
end
*constraints file*
function [c,ceq] = paradeigma4constraints(var)
% Περιέχει τους μη γραμμικούς περιορισμούς του προβλήματος 4
L=30;
V=80;
D=var(1);
W=var(2);
%Περιορισμοί
c=[];
ceq=[2.66*10^(-9)*(L*V^3)/D^5+1.78*10^(-10)*(L*V^2.68)/D^4.68-W];
end
script file
% script paradeigma4.m
% επιλύει το πρόβλημα 4
clc
L=30;
V=80;
D=var(1);
W=var(2);
var0=[1.1,0.25];
[D,W,C]=fmincon(@objparadeigma4,var0,[],[],[],[],0.25,6,@paradeigma4constraints);
disp('η βελτιστη τιμή της συναρτήσεως είναι c='),disp(C),disp('για D και για W = ')
disp(D),disp(W)

댓글 수: 5

Jan
Jan 2012년 2월 15일
Do you mean that Matlab is busy? Is this a problem or an effect of the complexity of the calculations?
Nikolaos
Nikolaos 2012년 2월 16일
Yes I mean that Matlab is busy continuously after that.
Jan
Jan 2012년 2월 16일
And you assume, that Matlab should be ready after some seconds already? Did you use the profiler to find out, where the time is spent in?
Oleg Komarov
Oleg Komarov 2012년 2월 17일
I think it's all those comments in greek, Matlab is trying to tarnslate them but it's not very good at languages...
Nikolaos
Nikolaos 2012년 2월 17일
Thank you, I'm trying the profiler and then using comments in English

댓글을 달려면 로그인하십시오.

 채택된 답변

Selwyn
Selwyn 2012년 2월 17일

0 개 추천

As a debugging suggestion, take the semicolon out of your [D,W,C]=fmincon..... statement and watch for output at the command line.
It should show if things are moving or standing still. If its standing still then I'd guess its something inside fmincon, but if its moving and giving values for D,W and C that you expect then its just busy calculating things.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Variables에 대해 자세히 알아보기

질문:

2012년 2월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by