Академический Документы
Профессиональный Документы
Культура Документы
1.1 Introduccin
MATLAB es un software comercial y una marca comercial de MathWorks, Inc.,
EE.UU. Se trata de un sistema de programacin integrado, incluyendo interfaces
grficas y un gran nmero de cajas de herramientas especializadas. MATLAB es ms
popular en todos los campos de las ciencias e ingeniera.
En esta seccin se presentan algunas nociones bsicas necesarias para la comprensin
del MATLAB, los ejemplos pueden ser copiados y pegados al editor del MATLAB para
su aplicacin con el interpretador o . Un estudio ms profundo de MATLAB puede
obtenerse a partir de muchos libros de MATLAB aplicado a la ingeniera y la ayuda
muy til de MATLAB.
5
Las matrices son el objeto fundamental de MATLAB y son particularmente tiles en la
ingeniera. Las matrices pueden ser creados en MATLAB de muchas formas, la ms
simple obtenido por los comandos
>> a=[1 2;3 4]
a=
1 2
3 4
Tenga en cuenta el punto y coma al final de cada lnea separa las filas matriz. Tambin
podemos generar matrices por funciones predefinidas, tales como matrices aleatorias
>> rand(2)
ans =
0.8147 0.1270
0.9058 0.9134
Matriz aleatoria rectangular
>> rand(2,4)
ans =
0.5144 0.5880
0.8843 0.1548
0.1999
0.4070
0.7487
0.8256
Matriz diagonal
>> eye(2)
ans =
1 0
1 1
Matriz de ceros
>> zeros(2)
IC/UNSA
ans =
0 0
0 0
0.1117 0.6787
0.1363 0.4952
>> b=rand(2,4)
b=
0.1897 0.1476
0.4950 0.0550
0.8507
0.5606
0.9296
0.6967
>> c=a+b
c=
0.9797 0.6817
0.8135 0.1449
0.9624
0.6969
1.6083
1.1918
IC/UNSA
0.6126
0.9900
2
5
8
3
6
9
2
5
8
0
0
3
6
9
0
0
0
0
0
1
1
0
0
0
1
1
IC/UNSA
unid='A'
switch unid
case 'A'
disp('Se eligio A')
case 'B'
disp('se eligio A')
otherwise
disp('no se completo')
end
Se eligio A
IC/UNSA
IC/UNSA
1.8 Relaciones
Relaciones en MATLAB son mostradas en la tabla 1.2.
Note la diferencia entre = e igual lgico ==. El operador lgico esta dado en
la tabla 1.3. El resultado es 0 (falso) o 1 (verdadero), como en
>> 3<5
ans =
1
>> 3>5
ans =
0
>> 3==5
ans =
0
Less than
Greater than
Less or equal than
Greater or equal than
Equal to
Not equal
and
or
not
0.6324
0.0975
0.2785
0.5469
b=
0.8147
0
0
0
ans =
1
0
0
0
1
1
1
0
1
1
0
0
0.9575
0.9649
0.1576
0.9706
0.9572
0.4854
0.8003
0.1419
1
1
1
1
IC/UNSA
0.7952
0.1869
0.4898
0.4456
0.6463
0.7094
0.7547
0.2760
0.6797
0.1493
0.2575
>> b=sin(a)
b=
0.7776 0.5203
0.8188 0.1382
0.1487
0.2547
>> c=sqrt(b)
c=
0.8818 0.7213
0.9049 0.3717
0.3857
0.5047
exp
log
rem
abs
sqrt
sign
round
floor
ceil
sum
prod
median
mean
any
all
Considere por ejemplo vector X = 1: 10. La suma, la media y los valores mximos son
evaluados como
>> x=1:10
x=
1
2
3
10
>> sum(x)
ans =
55
IC/UNSA
>> mean(x)
ans =
5.5000
IC/UNSA
OPERADORES ARITMTICOS
MATLAB puede operar con matrices por medio de operadores y por medio de
funciones. Se han visto ya los operadores suma (+), producto (*) y traspuesta ('), as
como la funcin invertir inv( ).
Tabla 1.6b Los operadores matriciales de MATLAB son los siguientes:
+
adicin o suma
sustraccin o resta
*
multiplicacin
'
traspuesta
^
potenciacin
\
divisin-izquierda
/
divisin-derecha
.*
producto elemento a elemento
./ y .\
divisin elemento a elemento
.^
elevar a una potencia elemento a elemento
>> A=[1 2;-1 2], b=[2;1],x=A\b
A=
1
2
-1
2
b=
2
1
x=
0.5000
0.7500
1.12 Submatrices
En MATLAB que es posible manipular matrices con el fin de hacer que el cdigo ms
compacto o ms eficiente. Por ejemplo, usando el colon podemos generar vectores,
como en
>> x=10:0.5:13
x=
10.0000 10.5000 11.0000 11.5000 12.0000 12.5000 13.0000
>> x=0:pi/4:pi
x=
0
0.7854
1.5708
2.3562
3.1416
>> b=sin(x)
b=
IC/UNSA
0.7071
1.0000
0.7071
0.0000
0
0.7071
1.0000
0.7071
0.0000
0.9293
0.3500
>> a(2,2)
ans =
0.2435
>> a=rand(2,3)
a=
0.3517
0.8308
0.5853
0.5497
0.9172
0.2858
>> a(2,2)
ans =
0.5497
>> a(1:2,2:3)
ans =
0.5853 0.9172
0.5497 0.2858
>> a(1,end)
ans =
0.9172
>> a(1,:)
ans =
0.3517
0.5853
0.9172
>> a(:,3)
ans =
0.9172
0.2858
Es interesante notar que las matrices se almacenan en la memoria de forma
lineal, a partir de la primera dimensin, segundo, y as sucesivamente. As
10
IC/UNSA
0.5853
0.5497
0.9172
0.2858
>> a(1)
ans =
0.3517
>> a(2),a(3),a(4),a(5)
ans =
0.8308
ans =
0.5853
ans =
0.5497
ans =
0.9172
Otra forma de introducir los subndices y obtener los elementos de la matriz
>> a([1 2 3 4 5 6])
ans =
0.3517
0.8308
0.5853
0.5497
0.9172
0.2858
>> a(:)
ans =
0.3517
0.8308
0.5853
0.5497
0.9172
0.2858
Operaciones con elementos de las matrices
>> a=rand(2,3)
a=
0.7572 0.3804
0.7537 0.5678
0.0759
0.0540
>> b=rand(1,3)
b=
0.5308 0.7792
0.9340
>> a(1,:)=b
a=
11
IC/UNSA
0.5308
0.7537
0.7792
0.5678
0.9340
0.0540
>> a(2,:)=0
a=
0.5308 0.7792 0.9340
0
0
0
>> a(2,3)=100
a=
0.5308 0.7792 0.9340
0
0 100.0000
Note en el ejemplo como incrementa automticamente el tamao de la
matriz
>> a(3,2)=20
a=
0.5308 0.7792 20.0000
0
0 100.0000
0 20.0000
0
0
0
1
1
1
0
0.7792
0
7.0000
7.0000
7.0000
0
12
IC/UNSA
Esto ser muy til en los clculos de elementos finitos, en particular cuando
se imponen condiciones de contorno.
program 1
programmer: Fidel Copa Pineda, IC/UNSA
date: 10/04/2015
purpose : mostramos como se construyen los archivos M-file
data: a - matriz de nmeros; b: matriz de senos de a
a=rand(3,4);
b=sin(a);
1.15 Graphics
MATLAB le permite producir grficos de una manera sencilla, ya sea ploteos en 2D o
3D.
13
IC/UNSA
1.15.1 Plot 2D
Usando el comando plot podemos producir plot 2D simples en una figura, utilizando
dos vectores con coordenadas x e y. Un ejemplo sencillo
x=-4:0.02:4; y=sin(x);plot(x,y)
Title
x-axis legend
y-axis legend
Sets limits to axis
ttulo
la leyenda del eje x
leyenda eje y
Establece lmites al eje
Automatic limits
Same scale for both
axis
Same scale for both
axis
Removes scale
Scales again
lmites automticos
Misma escala para ambos
ejes
Misma escala para ambos
ejes
elimina incrustaciones
Escalas de nuevo
Ejemplo
Crear un archivo de comandos y escriba el siguiente cdigo Fidel Copa Pineda
14
IC/UNSA
x = [0 : 0.01: 10];
y = exp(-x).* sin(2*x + 3);
plot(x, y), axis([0 10 -1 1])
La generacin de sub-graficas
Cuando se crea una serie de diagramas en la misma figura, cada una de estos diagramas se
llama un subplot. El comando trama secundaria se utiliza para la creacin de subplot.
Sintaxis del comando es subplot(m, n, p)
15
IC/UNSA
16
IC/UNSA
1.15.2 Plot 3D
Sintaxis
plot3(X1,Y1,Z1,...)
plot3(X1,Y1,Z1,LineSpec,...)
plot3(...,'PropertyName',PropertyValue,...)
plot3(axes_handle,...)
h = plot3(...)
Descripcin
The plot3 function displays a three-dimensional plot of a set of data points.
plot3(X1,Y1,Z1,...), where X1, Y1, Z1 are vectors or matrices, plots one or more lines in threedimensional space through the points whose coordinates are the elements of X1, Y1, and Z1.
plot3(X1,Y1,Z1,LineSpec,...) creates and displays all lines defined by
the Xn,Yn,Zn,LineSpec quads, where LineSpec is a line specification that determines line style,
marker symbol, and color of the plotted lines.
plot3(axes_handle,...) plots into the axes specified by axes_handle instead of into the current axes
(gca). The option, axes_handle can precede any of the input combinations in the previous syntaxes.
h = plot3(...) returns a column vector of charting line handles, with one handle per object.
Ejemplos
Dibuja una Helicoide en 3D
z ( a )=a
Fidel Copa Pineda
17
IC/UNSA
a = 0:pi/60:6*pi;
sx1 = a.*sin(a);
cy1 = a.*cos(a);
z1 = a;
sx2 = a/5.*sin(a);
cy2 = 1.5*a.*cos(a);
z2 = a/1.5;
figure
plot3(sx,cy,z1,sx2,cy2,z2)
18
IC/UNSA
19
IC/UNSA
Hola gente
espero que estn muy bien, este es mi primer vdeo tutorial y bueno creo
que estara bien sobre VB 6.0 en 64Bits ya que mucha gente no puede
instalarlo, lo primero que quiero dejarles es que el VB 6.0 se instala mas no
queda registrado en el cpu pero igual forma funciona correctamente ya en el
vdeo vieron un ejemplo y si funciona espero que a ustedes tambien aqui les
dejo una mini tutorial escrito:
COMO INSTALAR VISUAL BASIC 6.0 EN WINDOWS 8 64 Bits:
1.- COPIAR EN UNA CARPETA EL VISUAL BASIC. Y LUEGO LO SIGUIENTE.
2.- Copiar el archivo setup/vs98ent.stf en la raiz del instalador y renombrar
por acmsetup.stf
3.- Copiar todo el contenido de la carpeta setup en la raiz del instalador
(donde se encuentra acmboot.exe).
4.- Ejecutar el archivo setup luego acmsetup.exe en la raiz del instalador
(donde se encuentra acmboot.exe).
- Eso es todo el instalador del Visual Studio 6 se iniciara.
Nota: El archivo vs98ent.stf tambin puede estar con nombre vs98pro.stf
--------------Problema con :
"Debe Ejecutar el Asistente para la instalacin antes de ejecutar ese
programa de instalacion"
Un usuario nos dio la solucin:
Amigos para los que les sale el erro: Debe ejecutar el asistente para la
instalacin antes de ejecutar este programa de instalacin. Tomen en
consideracin lo siguiente:
1.- Una vez descomprimida la carpeta, ingresen a la carpeta de Setup.
2.- Cmbiale el nombre al archivo vs98ent.stf o vb98pro.stf que est en la
carpeta setup, y Renombrarlo como acmsetup.stf, despus cpialo a la
carpeta raiz.
Nota: El archivo vs98ent.stf tambin puede estar con nombre vs98pro.stf
3.-Regresa a la carpeta Setup y regresale el nombre al archivo que se lo
habas cambiado. (Lo que hiciste en el paso 2) O sea al archivo que
renombraste como acmsetup.stf vuelve a escribir su nombre original que
tena, ya sea vs98ent.stf o vb98pro.stf
Y Copiar todo el contenido de la carpeta setup en la raiz del instalador
(donde se encuentra acmboot.exe).
4.- Ejecutar el archivo setup (este se encuentra en la carpeta raz). Si en
este paso al ejecutar el setup les manda da error de compatibilidas hacer
caso omiso y continuar.
5.- Por ultimo ejecutar el acmsetup.exe que se encuentra en la raz del
instalador (donde se encuentra acmboot.exe).
6.- si se te queda colgado, solo cirralo y listo.
7.- AHORA como no te sale ningn icono en el escritorio. Busca el programa
en: Equipo, luego en C, luego en archivos de programa, Microsoft Visual
Studio, VB98 y dentro de esta ltima carpeta busca el que dice VB6, le das
clic derecho y le das enviar a escritorio (crear acceso directo).
20
IC/UNSA
_________
Alguna duda djenme comentario intentare solucionarles, estar subiendo el
VB 6.0 (OJO no esta full el programa).. Suscribanse a mi canal, den Like si
les gusto y hagan pedidos y les notificare la subida del Tutorial.
-Link del Visual Basic 6.0 (VB6):
http://bc.vc/d6rhCG
I=0.005m4
A=0.125m2
L=5m
E=1x106Kgf/cm2
21
IC/UNSA
FRAME3D
Programa para el Anlisis Estructural en el plano con 3GDL
programa elaborado 1986 se lee con un programa de la
dcada del 90 el mismo que anteriormente se explica su
aplicacin a Windows 7, 8.1 y 10.
' PROGRAMA PARA ANALIZAR MARCOS PLANOS CON ARMADURAS Y
MUROS DE CORTANTE
'
Y MIEMBROS DE CORTE CON ZONAS RIGIDAS
' Acepta diferentes tipos de miembros: 0,1,2,3,4,5
' donde:
' 1 = elemento continuo, 2 y 3 elemento articulado en un extremo j or k
respectivamente
' 4 = axial+cortante+flexion (shear Wall), 5 = axial+cortante+flexion+brazos
rigidos
' almacena matriz de banda inferior de la matriz de rigidez ancho = 2*mud+1
' la solucion del sistema de ecuaciones se encuentra por el metodo de Choleski
'
' SI UN HOMBRE ES PERSEVERANTE, AUNQUE SEA DURO DE ENTENDIMIENTO SE
' HARA INTELIGENTE; Y AUNQUE SEA DEBIL SE TRANSFORMARA EN FUERTE
'
LEONARDO DA VINCI
'
' PROGRAMA DESARROLLADO POR: FIDEL DANIEL COPA PINEDA, AREQUIPA PERU
1986
' Update al analisis inelastico 1999, Lima-Peru
Const ntr = 13, ndim1 = 16000, am = 100, anj = 200
' VARIABLES COMPARTIDAS EN SUBRUTINAS (IDENTIFICADORES GLOBALES)
Dim nombre$, nl, mud, m, nj, en, e, n, np1, ijj
Dim code$, i, j, k, mt, cx, cy, qi, qa, ql, zri, zrd
Dim ijk, mm, nm, nb, mx, ndf, mdi, nend
Dim ic1, ic2, ic3, ic4, ic5, ic6, ic7, ic8, IC9$
Dim icode$, ib1, ab1, ab2, ab3, ab4, a, b
Dim l38, l39, p11, p22, p33, p44, p55, p66
Dim kl, w, wu, xx1, xx2, sina, cosa, k11, k22, k33
Dim qqq$, prt$
Dim escd, escm, escmd, dmax, dmax0, mmax0, x00, y00, xl1, yl1, xl, yl
Dim k111(am, 6), cx1(am), cy1(am), e1(am), qi1(am), qa1(am)
Dim dm(6), k1(6), fem(6), femt(6), femr(6, am)
Dim pj(am), qk(am), rj(am), sk(am), tj(am), uk(am), mt2(am), ql1(am)
Dim ird(anj), ivd(anj), ihd(anj), x(anj), y(anj), zri1(am), zrj1(am)
Dim stif(ndim1), dx(am, ntr), mx1(am, ntr), vx1(am, ntr)
'fx1(am, ntr)
' Dim Shared MXx$(am, ntr), vxx$(am, ntr), femm$(am, ntr)
Dim xx(am, ntr)
Dim t(6, 6), ak(6, 6), akt(6, 6), ts(6, 6), jj(am), kk(am)
Private Sub archiva()
cx1(i) = cx
cy1(i) = cy
e1(i) = e
qi1(i) = qi
qa1(i) = qa
k111(i, 1) = k1(1)
k111(i, 2) = k1(2)
k111(i, 3) = k1(3)
k111(i, 4) = k1(4)
22
IC/UNSA
k111(i, 5) = k1(5)
k111(i, 6) = k1(6)
End Sub
Sub carga_distribuida(q, xx1, xx2, ql, cosa)
Static a, b, c, d, c1, l, j, k, x
a = xx1
b = xx2
l = ql
j = kl
d=l-a
c=l-b
smd = smd - q / 12 / l / l * (d * d * d * (4 * l - 3 * d) - c * c * c * (4 * l - 3 * c))
smi = smi + q / 12 / l / l * (b * b * b * (4 * l - 3 * b) - a * a * a * (4 * l - 3 * a))
r1 = (d * d - c * c) * q / 2 / l
r2 = (b * b - a * a) * q / 2 / l
rfd = rfd + r1
rfi = rfi + r2
c1 = -1 / 6 * r1 * l * l + q / 24 / l * (d * d * d * d - c * c * c * c)
For k = 1 To ntr
x = xx(j, k)
If x <= a Then
mx1(j, k) = mx1(j, k) + r1 * x
vx1(j, k) = vx1(j, k) + 0
dx(j, k) = dx(j, k) + r1 * x * x * x / 6 + c1 * x
End If
If x >= a And x <= b Then
mx1(j, k) = mx1(j, k) + r1 * x - q * (x - a) * (x - a) / 2
vx1(j, k) = vx1(j, k) - q * (x - a)
dx(j, k) = dx(j, k) + r1 * x * x * x / 6 - q / 24 * (x - a) * (x - a) * (x - a) * (x - a)
+ c1 * x
End If
If x > b Then
mx1(j, k) = mx1(j, k) + r2 * (l - x)
vx1(j, k) = vx1(j, k) - q * (a - b)
dx(j, k) = dx(j, k) + r1 * x * x * x / 6 - q / 24 * ((x - a) * (x - a) * (x - a) * (x - a)
- (x - b) * (x - b) * (x - b) * (x - b)) + c1 * x
End If
Next k
End Sub
Sub carga_puntual(q, xx1, ql, cosa)
Static a, b, l, j, k, x
a = xx1
l = ql
j = kl
b=l-a
smd = smd - q * a * b * b / l / l
smi = smi + q * a * a * b / l / l
rfd = rfd + q * b / l
rfi = rfi + q * a / l
For k = 1 To ntr
x = xx(j, k)
If x <= a Then
mx1(j, k) = mx1(j, k) + q * b * x / l
vx1(j, k) = vx1(j, k) + 0
dx(j, k) = dx(j, k) + q * b * x / 6 / l * (-l * l + b * b + x * x)
End If
If x > a Then
mx1(j, k) = mx1(j, k) + q * a * (l - x) / l
23
IC/UNSA
vx1(j, k) = vx1(j, k) - q
dx(j, k) = dx(j, k) + q * b * x / 6 / l * (-l * l + b * b + x * x) - q * (x - a) * (x - a)
* (x - a) / 6
End If
Next k
End Sub
Sub cholesky(n, mm, ib, nt)
Static i, j, k, ii, id, j1, j2, ina, jr, ks As Integer
Static l, ll, lm, m5, mud, nb, nm, ns, nr As Integer
Static s1, t1, sum As Double
mud = mm - 1
ns = mud * mm / 2
nm = n * mm - ns
If nt = 1 Then 'Computa la matriz G ===> A= Mat(G)*Tran(Mat(G))
For j = 1 To n
If j > mud Then
ina = j - mud
l = ina + (j - mm) * mud + ns
Else
ina = 1
l = ina + (j - 1) * j / 2
End If
If i - n + mud > 0 Then
m5 = n
Else
m5 = j + mud
End If
s1 = 0
j1 = j - 1
j2 = j + 1
If j1 > 0 Then
For k = ina To j1
t1 = stif(l)
s1 = s1 + t1 * t1
l=l+1
Next k
End If
t1 = stif(l)
If t1 < s1 Then
End
End If
t1 = Sqr(t1 - s1)
stif(l) = t1
If j < n Then
For i = j2 To m5
sum = 0
If i > mud Then
ina = i - mud
ll = ina + (i - mm) * mud + ns
Else
ina = 1
ll = ina + (i - 1) * i / 2
End If
If j1 > 0 And ina <= j1 Then
For k = ina To j1
lm = l + k - j
sum = sum + stif(ll) * stif(lm)
ll = ll + 1
Next k
24
IC/UNSA
End If
stif(ll) = (stif(ll) - sum) / stif(l)
Next i
End If
Next j
End If
' Empieza la sustitucion hacia adelante
nr = ib + 1
nb = nm + 1
For k = 1 To nr
stif(nb) = stif(nb) / stif(1)
For i = 2 To n
If i > mud Then
ina = i - mm
ks = ina * mud + ns
m5 = mud
Else
ina = 0
m5 = i - 1
ks = m5 * i / 2
End If
sum = 0
For j = 1 To m5
jr = j + ina
l = jr + ks
jr = jr + nb - 1
sum = sum + stif(l) * stif(jr)
Next j
id = i + ks
stif(jr + 1) = (stif(jr + 1) - sum) / stif(id)
Next i
nb = nb + n
Next k
' Empieza la sustitucion hacia atraz
nb = nm + n
For k = 1 To nr
stif(nb) = stif(nb) / stif(nm)
For ii = 2 To n
i = n - ii + 1
If i > mud Then
id = i + (i - mm) * mud + ns
Else
id = i + (i - 1) * i / 2
End If
If i - n + mm > 0 Then
m5 = ii - 1
Else
m5 = mud
End If
sum = 0
For j = 1 To m5
jr = i + j
If jr - mud > 0 Then
l = i + (jr - mm) * mud + ns
Else
l = i + (jr - 1) * jr / 2
End If
jr = nb - n + jr
sum = sum + stif(l) * stif(jr)
Next j
25
IC/UNSA
jr = nb - n + i
stif(jr) = (stif(jr) - sum) / stif(id)
Next ii
nb = nb + n
Next k
End Sub
Sub cortantes()
Static j2, k2, xr, mmx
Cls
' escalas
'Print m, ntr, escm
' DEFTEXT 1, 0, 0, 4
For ijk = 1 To m
lee
j2 = jj(ijk)
k2 = kk(ijk)
Line (x00 + x(j2) * escd, y00 - y(j2) * escd)-(x00 + x(k2) * escd, y00 - y(k2) *
escd)
'TEXT x00 + x(J) * escd, y00 - Y(J) * escd, J
'TEXT x00 + x(k) * escd, y00 - Y(k) * escd, k
For k = 1 To ntr
xr = xx(ijk, k)
mmx = -vx1(ijk, k) - femr(2, ijk)
xl = xr * cx * escd - mmx * cy * escm + x(j2) * escd + x00
yl = -(xr * cy * escd + mmx * cx * escm) - y(j2) * escd + y00
dibuja
'
If k = 1 Or k = ntr Then
'TEXT xl, yl, ROUND(mmx, 1)
'
End If
Next k
Next ijk
'DEFTEXT 1, 0, 0, 6
'TEXT x00, y00 + 30, "FUERZAS CORTANTES: " + nombre$ + "Estado de
Carga No.: " + STR$(ijj)
Print "FUERZAS CORTANTES: " + nombre$ + " Estado de Carga No.:" + Str$
(ijj); " "; code$
' prt.envolvente.cortantes
'opcion lista envolvente de momentos
End Sub
Private Sub datestruc()
Input #1, nombre$
' , prt$
Print "~~~~ANALISIS ESTRUCTURAL DE MARCOS CON ARMADURA EN EL PLANO
~~~~": code$ = "SOFTWARE LINCE"
n = 0: mx = 1
Print "DATOS DE LA ESTRUCTURA :", nombre$; " "; code$
Input #1, m, nj, nl, en
Print "M,NJ,NL,En="; m; ","; nj; ","; nl; ","; en
End Sub
Sub datcoord()
Print "COORDENADAS DEL NUDO J"
Print Tab(1); "J"; Tab(5); "IHR"; Tab(15); "IVR"; Tab(25); "itr"; Tab(35); "Xcoor";
Tab(45); "Ycoor"
For i = 1 To nj
Input #1, j, ihr, ivr, itr, xcoor, ycoor
Print Tab(1); j; Tab(5); ihr; Tab(15); ivr; Tab(25); itr; Tab(35); xcoor; Tab(45);
ycoor
x(j) = xcoor
y(j) = ycoor
26
IC/UNSA
27
IC/UNSA
Next i
For l = 1 To 6
k11 = k1(l) + nm
If k11 > ndim1 Then
k11 = ndim1
End If
stif(k11) = stif(k11) - femt(l)
Next l
Next lll
End If
End Sub
Sub datmember()
Static lp, mp
Print "DATOS DE LA ESTRUCTURA :", nombre$
Print "DATOS DEL MIEMBRO"
Print Tab(1); "I"; Tab(5); "J"; Tab(10); "K"; Tab(15); "Mt"; Tab(20); "Qi"; Tab(33);
"Qa"; Tab(43); "ZRI"; Tab(50); "ZRD"; Tab(60); "L"
' Print "MATRIZ DE RIGIDEZ DE LA ESTRUCTURA: "; n; " x "; n
For ijk = 1 To m
Input #1, i, j, k, mt, qi, qa, e, zri, zrd
'
Print i, j, k, mt, qi, qa, e, zri, zrd
If e = 0 Then
e = en
End If
jj(ijk) = j
kk(ijk) = k
zri1(i) = zri
zrj1(i) = zrd
k1(1) = ihd(j)
k1(2) = ivd(j)
k1(3) = ird(j)
k1(4) = ihd(k)
k1(5) = ivd(k)
k1(6) = ird(k)
For lp = 1 To 6
' computa ancho de media banda=mud
For mp = lp To 6
If k1(lp) < ndim1 And k1(mp) < ndim1 Then
mdi = Abs(k1(lp) - k1(mp))
If mdi > mud Then
mud = mdi
End If
End If
Next mp
Next lp
ql = Sqr((x(k) - x(j)) * (x(k) - x(j)) + (y(k) - y(j)) * (y(k) - y(j)))
ql2 = ql
mt2(i) = mt
ql1(i) = ql
cx = (x(k) - x(j)) / ql
cy = (y(k) - y(j)) / ql
Print Tab(1); i; Tab(5); j; Tab(10); k; Tab(15); mt; Tab(20); qi; Tab(33); qa;
Tab(43); zri; Tab(50); zrd; Tab(60); ql
vector
archiva
Next ijk
mud = mud + 1
mm = mud + 1
nm = n * mm - mm * mud / 2
For ijk = 1 To m
28
IC/UNSA
lee
i = ijk
rota cx, cy
member e, qi, qa, ql1(i), mt2(i), zri1(i), zrj1(i)
store mud, ndim1
Next ijk
nb = nm + 1
nend = nm + n
End Sub
Sub deflextion()
Static factor, k22k, k11k
Cls
' escalas
For ijk = 1 To m
lee
k = kk(ijk): replay (k)
k22k = k22: k11k = k11
j = jj(ijk): replay (j)
mm1 = (y(k) - y(j)) * escd + (stif(k22k) - stif(k22)) * escmd
mm2 = (x(k) - x(j)) * escd + (stif(k11k) - stif(k11)) * escmd
ql = Sqr(mm1 * mm1 + mm2 * mm2)
cx = mm2 / ql
cy = mm1 / ql
ql = ql / escd
factor = ql / xx(ijk, ntr)
For k = 1 To ntr
xr = xx(ijk, k) * factor
mmx = dx(ijk, k)
mmx = mmx - femr(6, ijk) * xr * ql * (1 - xr * xr / ql / ql) / 6
mmx = mmx + femr(3, ijk) * xr * (ql - xr) * (2 * ql - xr) / ql / 6
If qi = 0 Then
mmx = 0
Else
mmx = mmx / e / qi
End If
xl = xr * cx * escd - mmx * cy * escmd + x(j) * escd + stif(k11) * escmd
+ x00
yl = -(xr * cy * escd + mmx * cx * escmd + y(j) * escd + stif(k22) *
escmd) + y00
dibuja
Next k
Next ijk
grafica1
'DEFTEXT 1, 0, 0, 6
'TEXT x00, y00 + 30, "DEFORMADA PORTICO: " + nombre$ + " Carga #: " +
STR$(ijj)
Print "DEFORMADA PORTICO: " + nombre$ + " Estado de Carga No.:" + Str$
(ijj); " "; code$
End Sub
Sub dibuja()
If k = 1 Then
xl1 = xl
yl1 = yl
End If
Line (xl, yl)-(xl1, yl1)
xl1 = xl
yl1 = yl
End Sub
29
IC/UNSA
Sub Desplazamientos()
Static mc1, mc2, mc3
Cls
FIXE = 1000000
Print
Print "RESULTADOS DE LA ESTRUCTURA :"; nombre$; " "; code$
Print Tab(1); "Deflexiones y Rotaciones en Nudos; Estado de Carga No."; ijj
Print Tab(1); "NUDO"; Tab(8); "DESPL HOR"; Tab(22); "DESPL VERT"; Tab(38);
"ROTACION"
For j = 1 To nj
replay (j)
mc1 = Format(stif(k11), "#.######0")
mc2 = Format(stif(k22), "#.######0")
mc3 = Format(stif(k33), "#.######0")
Print Tab(1); j; Tab(8); mc1; Tab(22); mc2; Tab(38); mc2
Next j
End Sub
Sub Esfuerzos()
Static mc1
Print
Print "RESULTADOS DE LA ESTRUCTURA :"; nombre$; " "; code$
Print Tab(1); "Momentos y Cortantes en Miembros; Estado de Carga No."; ijj
Print Tab(2); "I J K"; Tab(16); "J AXIAL"; Tab(26); "J CORTE";
Print Tab(36); "J MOMENT"; Tab(46); "K AXIAL";
Print Tab(56); "K CORTE"; Tab(66); "K MOMENT"
For ijk = 1 To m
replaysol
Print Tab(1); i; Tab(5); jj(i); Tab(9); kk(i);
For ii = 1 To 6
mc1 = Format(fem(ii), "######.##")
Print Tab(12 * ii + 4);
Print mc1;
femr(ii, ijk) = fem(ii)
Next ii
Next ijk
End Sub
Sub asignam()
dmax0 = 0
For j = 1 To nj
replay (j)
dmax0 = max(dmax0, Abs(stif(k33)))
dmax0 = max(dmax0, Abs(stif(k22)))
Next j
mmax0 = 0
For ijk = 1 To m
replaysol
For ii = 1 To 6
femr(ii, ijk) = fem(ii)
mmax0 = max(mmax0, Abs(fem(ii)))
Next ii
Next ijk
If mmax0 = 0 Then
escm = 1
Else
escm = 400 / mmax0
End If
escmd = escm * 20
End Sub
30
IC/UNSA
Sub drawing()
ql = ql / escd
factor = ql / xx(ijk, ntr)
For k = 1 To ntr
xr = xx(ijk, k) * factor
mmx = dx(ijk, k)
mmx = mmx - femr(6, ijk) * xr * ql * (1 - xr * xr / ql / ql) / 6
mmx = mmx + femr(3, ijk) * xr * (ql - xr) * (2 * ql - xr) / ql / 6
If qi = 0 Then
mmx = 0
Else
mmx = mmx / e / qi
End If
xl = xr * cx * escd - mmx * cy * escm + x(j) * escd + stif(k11) * escm + x00
yl = -(xr * cy * escd + mmx * cx * escm + y(j) * escd + stif(k22) * escm) +
y00
dibuja
Next k
End Sub
Sub envolvente_cortantes()
Print "FUERZAS CORTANTES"
For ijk = 1 To m
lee
j = jj(ijk)
k = kk(ijk)
Print tramo; ijk
For k = 1 To ntr
xr = xx(ijk, k)
mmx = -vx1(ijk, k) - femr(2, ijk)
Print Tab(5 + k * 9); USING; "#####.#"; mmx;
Next k
Next ijk
End Sub
Sub escalas()
escd = 150
x00 = 1000
y00 = 5500
End Sub
Sub fix2(w, a, b, ql, mt, sina, cosa)
Static tp
If mt > 1 Then
GoTo 8000
End If
b1 = b
b = ql - a
a = ql - b1
8000:
If Abs(b - a) - 0.05 <= 0 Then
wu = w * cosa
p11 = w * sina * (ql - a) / ql
p44 = w * sina - p11
carga_puntual wu, xx1, ql, cosa
Else
p44 = w * sina * (b - a) * (a + b) / 2 / ql
p11 = w * sina * (b - a) - p44
wu = w * (b - a) * cosa
31
IC/UNSA
32
IC/UNSA
'
1)
2)
3)
4)
5)
6)
33
IC/UNSA
ak(4, 1) = -c1
ak(4, 4) = c1
Select Case mt
Case 0
ak(2, 2) = c2
ak(2, 3) = c3
ak(2, 5) = -c2
ak(2, 6) = c3
ak(3, 2) = c3
ak(3, 3) = 2 * c4
ak(3, 5) = -c3
ak(3, 6) = c4
ak(5, 2) = -c2
ak(5, 3) = -c3
ak(5, 5) = c2
ak(5, 6) = -c3
ak(6, 2) = c3
ak(6, 3) = c4
ak(6, 5) = -c3
ak(6, 6) = 2 * c4
' NOTA CONTINUA ESTA RUTINA EN LA PAG. SIGUIENTE
Case 1
ak(2, 2) = c7
ak(2, 5) = -c7
ak(2, 6) = c6
ak(5, 2) = -c7
ak(5, 5) = c7
ak(5, 6) = -c6
ak(6, 2) = c6
ak(6, 5) = -c6
ak(6, 6) = c5
Case 2
ak(2, 2) = c7
ak(2, 3) = c6
ak(2, 5) = -c7
ak(3, 2) = c6
ak(3, 3) = c5
ak(3, 5) = -c6
ak(5, 2) = -c7
ak(5, 3) = -c6
ak(5, 5) = c7
Case 4
' muro de cortante
V = 0.166
' relacin de Poisson
ff = 1.2
' factor de forma
g = e / (2 + 2 * V) ' Mdulo de rigidez o de cortante
alfa = 12 * e * qi / ql / ql / g / qa * ff
c1 = e * qi / ql / (1 + alfa)
c4 = (2 - alfa) * c1
c3 = 6 * c1 / ql
c2 = 2 * c3 / ql
c5 = (4 + alfa) * c1
ak(2, 2) = c2
ak(2, 3) = c3
ak(2, 5) = -c2
ak(2, 6) = c3
ak(3, 2) = c3
ak(3, 3) = c5
ak(3, 5) = -c3
ak(3, 6) = c4
34
IC/UNSA
ak(5, 2) = -c2
ak(5, 3) = -c3
ak(5, 5) = c2
ak(5, 6) = -c3
ak(6, 2) = c3
ak(6, 3) = c4
ak(6, 5) = -c3
ak(6, 6) = c5
Case 5
' muro o viga de corte con zonas rgidas
V = 0.166
' relacin de Poisson
ff = 1.2
' factor de forma
g = e / (2 + 2 * V) ' Mdulo de rigidez o de cortante
d = zri / ql
b = zrd / ql
c = (1 - d - b)
alfa = 12 * e * qi / c / c / ql / ql / g / qa * ff
c11 = e * qa / ql / c
c1 = e * qi / ql / (1 + alfa)
c2 = 12 * c1 / c / c / c / ql / ql
c3 = c1 * (6 / c / c + 12 * d / c / c / c) / ql
c4 = c1 * (6 / c / c + 12 * b / c / c / c) / ql
c5 = c1 * ((2 - alfa) / c + (6 * d + 6 * b) / c / c + 12 * d * b / c / c / c)
c6 = c1 * ((4 + alfa) / c + 12 * d / c / c + 12 * d * d / c / c / c)
c7 = c1 * ((4 + alfa) / c + 12 * b / c / c + 12 * b * b / c / c / c)
ak(1, 1) = c11
ak(1, 4) = -c11
ak(4, 1) = -c11
ak(4, 4) = c11
ak(2, 2) = c2
ak(2, 3) = c3
ak(2, 5) = -c2
ak(2, 6) = c4
ak(3, 2) = c3
ak(3, 3) = c6
ak(3, 5) = -c3
ak(3, 6) = c5
ak(5, 2) = -c2
ak(5, 3) = -c3
ak(5, 5) = c2
ak(5, 6) = -c4
ak(6, 2) = c4
ak(6, 3) = c5
ak(6, 5) = -c4
ak(6, 6) = c7
End Select
For ii = 1 To 6
For l = 1 To 6
ts(ii, l) = 0
For jj = 1 To 6
ts(ii, l) = ts(ii, l) + ak(ii, jj) * t(jj, l)
Next jj
Next l
Next ii
For ii = 1 To 6
For l = 1 To 6
akt(ii, l) = 0
For jj = 1 To 6
akt(ii, l) = akt(ii, l) + t(jj, ii) * ts(jj, l)
Next jj
35
IC/UNSA
Next l
Next ii
End Sub
Sub momentos()
Static mm1, mmx, xr, j2, k2
Cls
' escalas
'DEFTEXT 1, 0, 0, 4
For ijk = 1 To m
lee
j2 = jj(ijk)
k2 = kk(ijk)
Line (x00 + x(j2) * escd, y00 - y(j2) * escd)-(x00 + x(k2) * escd, y00 - y(k2) *
escd)
' Text x00 + x(j) * escd, y00 - y(j) * escd, j
' Text x00 + x(k) * escd, y00 - y(k) * escd, k
For k = 1 To ntr
' Print ntr, mm1, mmx
xr = xx(ijk, k)
mm1 = -femr(3, ijk) + (femr(3, ijk) + femr(6, ijk)) / ql1(ijk) * xr
mmx = -mx1(ijk, k) - mm1
xl = xr * cx * escd - mmx * cy * escm + x(j2) * escd + x00
yl = -(xr * cy * escd + mmx * cx * escm) - y(j2) * escd + y00
'
Print ql1(ijk), " ", ijk, " ", xr, "--", mx1(ijk, k2), "*", femr(3, ijk), "*", femr(6, ijk)
'xl, yl, mm1, mmx
dibuja
'
If k = 1 Or k = ntr Then
' TEXT kl, yl, ROUND(-mmx, 1)
'
End If
Next k
Next ijk
'TEXT x00, y00 + 30, "MOMENTOS FLECTORES: " + nombre$ + "Estado de Carga
No.:" + STR$(ijj)
Print "MOMENTOS FLECTORES: " + nombre$ + " Estado de Carga No.:" + Str$(ijj);
" "; code$
End Sub
Sub p8006()
If l39 <> 1 Then
Print "DATOS DE LA ESTRUCTURA :", nombre$
Print Tab(1); "CODE"; Tab(6); "Miembro"; Tab(14); "Carga"; Tab(24); "Xinix";
Tab(34); "Xfinal"; Tab(44); "Alfa"
End If
kl = ib1
mt = mt2(kl)
l39 = 1
w = ab1
If ab3 - ab2 >= 0.05 Then
w = ab1
End If
xx1 = ab2
xx2 = ab3
alpha = ab4
Print Tab(1); icode$; Tab(6); ib1; Tab(14); ab1; Tab(24); ab2; Tab(34); ab3; Tab(44);
ab4
If alpha = 0 Then
cosa = 1
sina = 0
GoTo 8020
36
IC/UNSA
End If
If alpha > 0 Then
GoTo 8011
End If
8009:
If alpha + 90 = 0 Then
cosa = 0
sina = 1
GoTo 8020
Else
GoTo 8012
End If
8011:
If alpha - 90 = 0 Then
cosa = 0
sina = 1
GoTo 8020
End If
8012:
alpha = alpha * PI / 180
cosa = Cos(alpha)
sina = Sin(alpha)
8020:
ql = ql1(kl)
If mt = 0 Or mt = 4 Or mt = 5 Then
fixed w, xx1, xx2, ql, sina, cosa
Else
fix2 w, xx1, xx2, ql, mt, sina, cosa
End If
pj(kl) = pj(kl) + p11
qk(kl) = qk(kl) + p22
rj(kl) = rj(kl) + p33
sk(kl) = sk(kl) + p44
tj(kl) = tj(kl) + p55
uk(kl) = uk(kl) + p66
End Sub
Sub p8732()
If l38 <> 1 Then
Print "DATOS DE LA ESTRUCTURA :", nombre$
Print "CARGAS EN LOS NUDOS: ESTADO DE CARGA"; ijj
Print Tab(1); "NUDO"; Tab(10); "FZA HORIZ"; Tab(25); "FZA VERT"; Tab(40);
"FZA PAR"
End If
j = ib1
l38 = 1
replay j
stif(k11) = stif(k11) + ab1
stif(k22) = stif(k22) + ab2
stif(k33) = stif(k33) + ab3
Print Tab(1); j; Tab(10); ab1; Tab(25); ab2; Tab(40); ab3
End Sub
Sub replay(uu)
k11 = ihd(uu) + nm
k22 = ivd(uu) + nm
k33 = ird(uu) + nm
If k11 > ndim1 Then
k11 = ndim1
End If
37
IC/UNSA
38
IC/UNSA
End If
mm = mud + 1
ns = mud * mm / 2
For l = 1 To 6
ii = k1(l)
For k = 1 To 6
jj = k1(k)
If ii < jj Then
GoTo 62100
End If
If ii >= ndf Or jj >= ndf Then
GoTo 62100
End If
ll = jj + (ii - mm) * mud + ns
If ii <= mud Then
ll = jj + (ii - 1) * ii / 2
End If
stif(ll) = stif(ll) + akt(l, k)
GoTo 62100
Line (40 + d4 * ii, 40 + d4 * jj)-(40 + d4
Line (40 + d4 * ii, 40 + d4 * jj)-(40 + d4
Line (40 + d4 * ii, 40 + d4 * jj + dh)-(40
Line (40 + d4 * ii + dh, 40 + d4 * jj)-(40
62100:
Next k
Next l
End Sub
* ii, 40 + d4 * jj + dh)
* ii + dh, 40 + d4 * jj)
+ d4 * ii + dh, 40 + d4 * jj + dh)
+ d4 * ii + dh, 40 + d4 * jj + dh)
Sub vector()
Static kk, xc
c1 = (ql - zrd - zri) / ql
xx(i, 1) = 0
xx(i, ntr) = ql
For kk = 2 To ntr - 1
xc = (kk - 2) * ql * c1 / (ntr - 3) + zri
xx(i, kk) = xc
Next kk
End Sub
Private Sub Command1_Click()
Cls
End Sub
Private Sub Command10_Click()
escd = escd * 1.1
grafica
End Sub
Private Sub Command11_Click()
escm = escm * 1.1
momentos
End Sub
Private Sub Command12_Click()
escm = escm * 0.9
momentos
End Sub
Private Sub Command13_Click()
escmd = escmd * 1.5
39
IC/UNSA
deflextion
End Sub
Private Sub Command14_Click()
escmd = escmd * 0.9
deflextion
End Sub
Private Sub Command15_Click()
End Sub
Private Sub Command2_Click()
grafica
End Sub
Private Sub Command3_Click()
momentos
' cortantes
' deflextion
End Sub
Private Sub Command4_Click()
deflextion
End Sub
Private Sub Command5_Click()
Esfuerzos
End Sub
Private Sub Command6_Click()
Desplazamientos
End Sub
Private Sub Command7_Click()
End
End Sub
Private Sub Command8_Click()
cortantes
End Sub
Private Sub Command9_Click()
escd = escd * 0.9
grafica
End Sub
Private Sub Form_activate()
'Clear
Static ii, jj
Print "Lince SoftWare"
ic1 = "S": ic2 = "j": ic3 = "m": ic4 = "L": ic5 = "P": ic6 = "N": ic7 = "E": ic8 = "Q"
Print ic4, ic5, ic6, ic7, ic8
' GoSub MnuLee
' commomdialog1
namem$ = "C:\Users\FCOPA\Music\AE2D\datos1.txt"
Open namem For Input As #1 ' Abre el archivo para recibir
' Open filea For Input As #1 ' Abre el archivo para recibir
' Open FileName For Input As #1 ' Abre el archivo para recibir
40
IC/UNSA
datestruc
datcoord
datmember
' Calcula rigideces de miembro y los almacena en [K]
escalas
'grafica
' grafica la geometra de la estructura codificada
'RESTORE datload
For ijj = 1 To nl
Print "ESTADO DE CARGA No.:********* "; ijj
For ii = 1 To m
For jj = 1 To ntr
mx1(ii, jj) = 0: vx1(ii, jj) = 0: dx(ii, jj) = 0
Next jj
Next ii
datload
datloadrota
np1 = n - 1
If mud > np1 Then
Print "Ancho de media banda > al admisible)"
End
End If
cholesky n, mm, 0, ijj
' retirar
stif(ndim1) = 0
asignam
Next ijj
Close #1 ' Cierra el archivo.
'Do While Not EOF(1) ' Repite el bucle hasta el
' Input #1,, MiCadena, MiNumero, Miaa, Miab, Miac ' Ponen los datos en las
variables.
'Loop
End Sub
Private Sub MnuFileExit_Click()
End
End Sub
Private Sub MnuLee_Click()
' Establecer CancelError a True
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
' Establecer los indicadores
CommonDialog1.Flags = cdlOFNHideReadOnly
' Establecer los filtros
CommonDialog1.Filter = "Todos los archivos (*.*)|*.*|Archivos de texto" & _
"(*.txt)|*.txt|Archivos por lotes (*.bat)|*.bat"
' Especificar el filtro predeterminado
CommonDialog1.FilterIndex = 2
' Presentar el cuadro de dilogo Abrir
CommonDialog1.ShowOpen
' Presentar el nombre del archivo seleccionado
filea = CommonDialog1.FileName
' MsgBox CommonDialog1.filename
'
main
'
escalasD
'
grafica3d
Exit Sub
ErrHandler:
' El usuario ha hecho clic en el botn Cancelar
Exit Sub
End Sub
41
IC/UNSA
42