17.04.2014 Views

Matlab Hogyan - Hidrodinamikai Rendszerek Tanszék

Matlab Hogyan - Hidrodinamikai Rendszerek Tanszék

Matlab Hogyan - Hidrodinamikai Rendszerek Tanszék

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

11. FEJEZET. PÉLDAPROGRAMOK 44<br />

function nyiltfelszin<br />

global B n g Q ii<br />

nyiltfelszin.m<br />

Q = 0.298; % eloirt terfogataram<br />

y0= 0.6; % szint a csatorna elején<br />

ii = 0.001; % hidraulikai lejtes<br />

n = 0.01; % csoerdesseg<br />

B = 0.5; % csatorna szelesseg<br />

g = 9.81; % gravitacio<br />

L = 1000; % csohossz<br />

Rh = y0*B/(2*y0+B);<br />

C = Rh^(1/6)/n;<br />

Qn = y0*B*C*sqrt(ii*Rh);<br />

fprintf(’\n Nyiltfelszinu csatornaaramlas\n’);<br />

fprintf(’\n %g m-es cs}oeleji felszinhez tartozó térfogatáram: %g m^3/s’,y0,Qn);<br />

% Megoldo hivasa:<br />

options=odeset(’events’,@rohanas);<br />

[x,y]=ode45(@nyiltfelszin_de,[0 L],y0,options);<br />

% A csatorna alja és az ahhoz képesti folydékszint (rajzoláshoz):<br />

for i=1:length(x)<br />

yy(i)=ii*(1-x(i)/L)*L;<br />

yf(i)=yy(i)+y(i); v(i) =Q/y(i)/B;<br />

end<br />

figure(1)<br />

subplot(2,1,1), plot(x,yy,x,yf);<br />

title([’Nyiltfelszin}u csatornaáramlás: i=’,num2str(ii),’<br />

ylabel(’folyadekfelszin, y [m]’,’FontSize’,12)<br />

legend(’csatorna feneke’,’folyadék felszíne’)<br />

axis([0 L 0 yf(1)*1.2])<br />

Q=’,num2str(Q)],’FontSize’,12);<br />

subplot(2,1,2), plot(x,v);<br />

xlabel(’csohossz, x [m]’,’FontSize’,12);<br />

ylabel(’aramlasi sebesseg, v [m/s]’,’FontSize’,12);<br />

%---------------------------------------------<br />

function dydx=nyiltfelszin_de(x,y)<br />

global B n g Q ii<br />

A=y(1)*B; Rh=y(1)*B/(2*y(1)+B); C=Rh^(1/6)/n;<br />

dydx=[ (ii-Q^2/A^2/C^2/Rh)/(1-Q^2*B/A^3/g)];<br />

%---------------------------------------------<br />

function [val,ter,dir]=rohanas(x,y)<br />

val=y(1); % Az esemény definiciója<br />

ter=1; % Állítsuk meg az integrálást.<br />

dir=0; % Mindkét irányban (1: + -> -, 2: - -> +)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!