Escolar Documentos
Profissional Documentos
Cultura Documentos
MATLAB
if b ~ = 0
r1=-c/b;
end
VISUAL BASIC
If b <> 0 Then
r1 = -c / b
End If
if a < 0
b = sqrt(abs(a));
else
b = sqrt(a);
end
If a < 0 Then
b =
sqrt(abs(a))
Else
b = sqr(a)
End If
If class = 1 Then
x = x + 8
ElseIf class < 1
Then
x = x - 8
ElseIf class < 10
Then
x = x - 32
Else
x = x - 64
End If
if class == 1
x = x + 8;
elseif class < 1
x = x 8;
elseif class<10
x = x -32;
else
x = x 64;
end
CASE:
SELECT CASE Expresin
de prueba
CASE Valor1
Bloque1
CASE Valor2
Bloque2
CASE Valor3
Bloque3
CASE ELSE
Bloque4
END SELECT
switch a + b
case 1
x = -5;
case 2
x = -5-(a+b)/10;
case 3
x = (a+b)/10;
otherwise
x = 5;
end
DOEXIT:
DO
Bloque1
IF condicIn EXIT
Bloque2
END DO
while 1
i = i + 1;
if i > = 10, break,
end
j = i * x;
end
LOOP CONTROLADO
POR CONTADOR:
DO FOR i=inicio,
incremento, fin.
Bloque
END FOR
for i = 1:2:10
x = x + i;
end
Select Case a + b
Case Is < -50
x = -5
Case Is < 0
x = -5 - (a +
b) / 10
Case Is < 50
x = (a + b) /
10
Case Else
x = 5
End Select
Do
i = i + 1
If i >= 10
Then Exit Do
j = i * x
Loop
For i = 1 To 10
Step 2
x = x + i
Next i
x=x-64;
end
x
Ejecutando el cdigo en ventana de comandos de MatLab
>> ifthenelseif
Ejemplo Codigo IF/THEN/ELSEIF
Ingrese valor de class : 15
Ingrese valor de x : 80
x =
16
Cdigo CASE
clear;
disp('Ejemplo Codigo CASE');
a=input('Ingrese valor de a : ');
b=input('Ingrese valor de b : ');
switch a+b
case 1
x=-5;
case 2
x=-5-(a+b)/10;
case 3
x=(a+b)/10;
otherwise
x=5;
end
x
Ejecutando el cdigo en ventana de comandos de MatLab
>> ejemplocase
Ejemplo Codigo CASE
Ingrese valor de a : 1
Ingrese valor de b : 2
x =
0.3000
Cdigo DOEXIT:
clear;
disp('Ejemplo Codigo DOEXIT');
x=input('Ingrese valor de x : ');
i=input('Ingrese valor de i : ');
while 1
i=i+1;
if i>=10,break,end
j=i*x;
end
j
FOR');
inicio : ');
final : ');
incremento : ');
x : ');
20
5
1.5
0.015
0.00035
4123.46
1.80
m /seg
m
m
s/u
m/m
y n 1 y n
f ( yn )
f ' ( yn )
s/u
Y
A
1.75
13.34375
1.82703016 14.1422096
1.8201231 14.0698876
1.82006028 14.0692305
P
11.31
11.59
11.56
11.56
T
10.25
10.4810905
10.4603693
10.4601808
A (b z y ) y
P b 2 y
1 z
T b 2 zy
A
P2
F
-816.06
89.73
0.80
0.00
Qn
S2
D
10594.0749
12990.4531
12758.9332
12756.8432
A 4(5PT4A 1 Z2 )
D
P3
Tirante Normal
Seccin Trapezoidal
Leer: Q,B,Z,Y,N,S,Err
C=(Q*N/sqrt(S))^3
L=sqrt(1+Z^2)
A=(B+Z*Y)*Y
P=B+2*Y*L
T=B+2*Z*Y
F=A^5/P^2-C
abs(F)>=Err
V
D=(A^4*(5*P*T-4*A*L))/P^3
Y1=Y-F/D
Y=Y1
F
V=Q/A
DH=A/T
NF=V/sqrt(9.81*DH)
EN=Y+V^2/(9.81*2)
Escriba: Y,V,NF,EN
A=(B+Z*Y)*Y
P=B+2*Y*L
T=B+2*Z*Y
F=A^5/P^2-C
FIN
m /seg
Q=
20
B=
5
m
Z=
1.5
m
N=
0.015
s/u
S = 0.00035 m/m
C = 4123.459
L=
1.803
s/u
ITERA
1
2
3
4
5
Y0
1.75
1.7501
1.82702
1.819402
1.820054
Y1
1.7501
1.82702
1.819402
1.820054
1.82006
yi 1 yi
A0
13.34375
13.34478
14.1421
14.06234
14.06917
P0
11.31
11.31
11.59
11.56
11.56
f ( yi )( yi 1 yi )
f ( yi 1 ) f ( yi )
A1
13.34478
14.1421
14.06234
14.06917
14.06923
P1
11.31
11.59
11.56
11.56
11.56
F0
-816.06
-815.00
89.59
-8.39
-0.08
F1
-815.00
89.59
-8.39
-0.08
0.00
A (b z y ) y
P b 2 y
1 z
T b 2 zy
Qn
A5
P2
S2
2
2
0.014
0.0004
1.4
m
m3/seg
s/u
m/m
y i 1 yi
f ( yi )( yi 1 y i )
f ( yi 1 ) f ( yi )
Y0
Y1
A0
P0
A1
P1
F0
F1
0.700000
0.700100
1.327657
1.240328
1.241703
1.241682
0.700100
1.327657
1.240328
1.241703
1.241682
1.241682
0.9799219
0.9801127
2.2141882
2.0467848
2.049454
2.0494128
2.5322073
2.532417
3.8092378
3.6270005
3.6298342
3.6297906
0.9801127
2.2141882
2.0467848
2.049454
2.0494128
2.0494128
2.532417
3.8092378
3.6270005
3.6298342
3.6297906
3.6297906
-0.879621
-0.879481
0.1421696
-0.002274
3.56E-05
6.853E-09
-0.879481
0.1421696
-0.002274
3.56E-05
6.853E-09
-2.09E-14
2y
x 2 Arc Cos 1
A
P
1
x Sen ( x)
8
1
2
x D
T D Sen (
x
)
2
D
x
1 Cos ( )
2
2
5
1
2
8 ( x Sen( x ))
Qn
Fx
1
2
1
3
S2
2 x D
10