1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| function [x,fval,exitflag,output]=zonal(xstart,options)
fun = @residus;
%options=optimset('Display','iter','MaxFunEvals',100000000,'MaxIter',1000,'TolFun',1e-10,'TolX',1e-6,'NonlEqnAlgorithm','dogleg','LineSearchType','cubicpoly','LargeScale','on'); % Option to display output
[x,fval,exitflag,output] = fsolve(fun,xstart,options) % Call optimizer
function F=residus(P)
global H
global M
global A
global T
global F
global debvent
nz=38;
g=9.81;
Cd=0.83;
R=287;
b=0.5;
%calcul des débits
[debit]=FLOW(P,T,b,R,nz,M,Cd,A,g,H);
%résidus
F=[-3*debvent -12*debvent -3*debvent 0 0 0 0 0 0 0 0 0 2*debvent 8*debvent 2*debvent 0 0 0 0 0 0 0 0 0 debvent 4*debvent debvent 0 0 0 0 0 0 0 0 0 0 0];
for i=1:38
for j=1:38
F(i)=F(i)-debit(i,j)+debit(j,i);
end
end |
Partager