ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Programa en MatLab para calcular el Tirante Normal de un flujo


Enviado por   •  8 de Octubre de 2015  •  Tareas  •  658 Palabras (3 Páginas)  •  455 Visitas

Página 1 de 3

PROGRAMAS HECHOS EN MATLAB PARA CALCULAR EL TIRANTE NORMAL DEL FLUJO EN DISTINTAS SECCIONES

SECCION RECTANGULAR

clc

input('TIRANTE NORMAL EN UNA SECCION RECTANGULAR')

i=0;xi2=0;fxi=0;fpxi=0;error=100;ant=0;A=0;R=0;T=0;p=0;

Q=input('Dame el valor de Q  :');

n=input('Dame el valor de n  :');

s=input('Dame el valor de s  :');

b=input('Dame el valor de b  :');

y=input('Dame el valor de y  :');

ed=input('Dame el error deseado  :');

disp('   i       Xi                 Xi+1             f(Xi)         f´(Xi)              ERROR');

while error>ed

    A=b*y;

    p=b+(2*y);

    R=(A/p);

    T=b;

    fxi=(A*(R^(2/3))-((Q*n)/(s^(0.5))));

    fpxi=(((5/3)*(R^(2/3))*T)-((4/3)*(R^(5/3))));

    xi2=y-(fxi/fpxi);

    error=abs(((xi2-ant)/xi2)*100);

    ant=xi2;

    fprintf('%5d%10.4f%18.4f%18.4f%18.4f%18.4f%%\n\n',i,y,xi2,fxi,fpxi,error);

    y=xi2;

    i=i+1;

end

fprintf('  el tirante normal es %10.5f\n Con un error de %6.4f%%\n\n\n',xi2,error);


SECCION TRIANGULAR

clc

input('TIRANTE NORMAL EN UNA SECCION TRIANGULAR')

i=0;xi2=0;fxi=0;fpxi=0;error=100;ant=0;A=0;R=0;T=0;p=0;

Q=input('Dame el valor de Q  :');

n=input('Dame el valor de n  :');

s=input('Dame el valor de s  :');

z=input('Dame el valor de z  :');

y=input('Dame el valor de y  :');

ed=input('Dame el error deseado  :');

disp('   i       Xi                 Xi+1             f(Xi)         f´(Xi)              ERROR');

while error>ed

    A=z*y^(2);

    p=2*y*sqrt(1+z^2);

    R=((z*y)/(2*sqrt(1+z^2)));

    T=2*z*y;

    fxi=(A*(R^(2/3))-((Q*n)/(s^(0.5))));

    fpxi=(((5/3)*(R^(2/3))*T)-((4/3)*(R^(5/3))*sqrt(1+z^2)));

    xi2=y-(fxi/fpxi);

    error=abs(((xi2-ant)/xi2)*100);

    ant=xi2;

    fprintf('%5d%10.4f%18.4f%18.4f%18.4f%18.4f%%\n\n',i,y,xi2,fxi,fpxi,error);

    y=xi2;

    i=i+1;

end

fprintf('  el tirante normal es %10.5f\n Con un error de %6.4f%%\n\n\n',xi2,error);


SECCION CIRCULAR

clc

input('TIRANTE NORMAL EN UNA SECCION CIRCULAR')

i=0;xi2=0;fxi=0;fpxi=0;error=100;ant=0;A=0;R=0;T=0;p=0;

Q=input('Valor (Q)  :');

n=input('Valor (n)  :');

s=input('Valor (s)  :');

Do=input('Valor (Do)  :');

y=input('Valor (y)  :');

ed=input('Error  :');

disp('   i       Xi                 Xi+1             f(Xi)         f´(Xi)              ERROR');

...

Descargar como (para miembros actualizados)  txt (3.8 Kb)   pdf (34.7 Kb)   docx (10.6 Kb)  
Leer 2 páginas más »
Disponible sólo en Clubensayos.com