-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChapa_Vibrando.m
265 lines (230 loc) · 6.19 KB
/
Chapa_Vibrando.m
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
%% Gabriel Prieto Paris
% P1 - PLACAS E CASCAS
close all
clear
clc
%% DADOS DE ENTRADA
% Elemento retangular de chapa
nnel=4; % Número de nós por elemento
nglpn=2;% Número de graus de liberdade por nó
% Dimensões do retângulo
compr=0.44; % [m]
alt=0.11; % [m]
% Divisões
ndx=8;ndy=2; % Elementos em x e elementos em y
nno=(ndx+1)*(ndy+1); % Número total de nós
nel=ndx*ndy; % Número de elementos
% Dimensões do problema
nds=nno*nglpn; % Número de deslocamentos do sistema
ndpel=nnel*nglpn;% Número de deslocamentos por elemento
ns=1;% Número de seções diferentes; se ns=1, todas iguais
% Dados físicos dos elementos
t=0.055; % [m]
EM=1e9; % [N/m^2]
nu=0.25;
ro=1000; % [kg/m^3]
EL=EM/(1-nu*nu);G=EM/2/(1+nu);
%% Inicialização de matrizes e vetores
gcoord=zeros(nno,2);
nodel=zeros(nel,nnel);
LN=zeros(nno,nglpn);
LM=zeros(nel,nglpn*nnel);
k=zeros(ndpel,ndpel);
m=zeros(ndpel,ndpel);
K=zeros(nds,nds);
M=zeros(nds,nds);
%% NÓS
% Geracao das coordenadas
dx=compr/ndx;dy=alt/ndy;
x=0;y=0;k=0;
for i=1:ndx+1
for j=1:ndy+1
k=k+1;
gcoord(k,1)=x;gcoord(k,2)=y;
y=y+dy;
end
y=0;
x=x+dx;
end
% Geracao da conectividade dos elementos
kel=0;kaux=0;
for i=1:ndx
for j=1:ndy
kaux=kaux+1;
kel=kel+1;
nodel(kel,1)=kaux+ndy+2;nodel(kel,2)=kaux+1;
nodel(kel,3)=kaux;nodel(kel,4)=kaux+ndy+1;
end
kaux=kaux+1;
end
%condições de contorno (n. de nó restrito e direções restritas ou livres)
%se fixa = -1; se livre = 0
%engaste de viga em balanco
LN(2,:)=[-1 -1];
LN(26,:)=[0 -1];
% Determinação das matrizes
% Matriz LN
ngl=0;
for i=1:nno
for j=1:nglpn
if LN(i,j)==0
ngl=ngl+1;
LN(i,j)=ngl;
end
end
end
ngr=ngl;
for i=1:nno
for j=1:nglpn
if LN(i,j)<0
ngr=ngr+1;
LN(i,j)=ngr;
end
end
end
% Matriz LM
for iel=1:nel
kl=0;
for i=1:nnel
ino=nodel(iel,i);
for j=1:nglpn
kl=kl+1;
LM(iel,kl)=LN(ino,j);
end
end
end
% Matriz de rigidez e massa
for iel=1:nel
xa=gcoord(nodel(iel,1),1);
xb=gcoord(nodel(iel,2),1);
yb=gcoord(nodel(iel,2),2);
yc=gcoord(nodel(iel,3),2);
% Dimensoes do retangulo
a=(xa-xb)/2;b=(yb-yc)/2;
% Constantes
c1=EL*t*b/3/a;c2=c1/2;c3=EL*t*nu/4;
c4=G*t*a/3/b;c5=c4/2;c6=G*t/4;
kd(1,1)=c1;kd(1,2)=c3;kd(1,3)=-c1;kd(1,4)=c3;kd(1,5)=-c2;kd(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kg]
M(LN(14,1),LN(14,1))=M(LN(14,1),LN(14,1))+massa1;
M(LN(14,2),LN(14,2))=M(LN(14,2),LN(14,2))+massa1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SOLUÇÃO
% Problema de autovalores e autovetores
[mod,fre]=eig(K(1:ngl,1:ngl),M(1:ngl,1:ngl));
disp('Primeira Frequencia em rad/s')
for i=1:ngl
om(i)=sqrt(fre(i,i));
end
disp(om(1))
% Grafico do primeiro modo (eixo)
X=zeros(ndx+1,1);mod1=zeros(ndx+1,1);
xe=0;
for i=1:ndx+1
noeixo=(i-1)*(ndy+1)+ndy/2+1;
ge=LN(noeixo,2);
X(i,1)=xe;
xe=xe+dx;
if ge<=ngl
mod1(i,1)=mod(ge,1);
else
mod1(i,1)=0;
end
end
figure(1)
plot(X,mod1,'r',X,-mod1,'g')
axis equal
legend('Máximo','Mínimo')
% Grafico do primeiro modo (todos os pontos)
for i=1:nno
for j = 1:2
ge=LN(i,j);
if ge<=ngl
mod_vib1(i,j)=mod(ge,1);
else
mod_vib1(i,j)=0;
end
end
end
figure(2)
hold on
patch('faces', nodel, 'vertices', gcoord+mod_vib1, 'FaceColor', 'none', 'LineStyle', '--', 'EdgeColor','red');
patch('faces', nodel, 'vertices', gcoord-mod_vib1, 'FaceColor', 'none', 'LineStyle', '--', 'EdgeColor','green');
axis equal
legend('Máximo','Mínimo')
hold off
%% ANIMAÇÃO DO PRIMEIRO MODO DE VIBRAÇÃO
n = 20;
dmodo = (mod_vib1+mod_vib1)/n;
altura = gcoord+mod_vib1;
for ii = 1:10
for i = 1:n
fig = figure(3);
clf
patch('faces', nodel, 'vertices', altura, 'FaceColor', 'blue', 'EdgeColor','blue');
axis([0 compr -0.2 0.2])
axis equal
axis off
altura = altura-dmodo;
frame = getframe(fig);
im{i} = frame2im(frame);
pause(0.01)
end
for i = 1:n
fig = figure(3);
clf
patch('faces', nodel, 'vertices', altura, 'FaceColor', 'blue', 'EdgeColor','blue');
axis([0 compr -0.2 0.2])
axis equal
axis off
altura = altura+dmodo;
frame = getframe(fig);
im{i+n} = frame2im(frame);
pause(0.01)
end
end
%% Criando GIF
% filename = 'Chapa Vibrando.gif'; % Specify the output file name
% for idx = 1:40
% [A,map] = rgb2ind(im{idx},256);
% if idx == 1
% imwrite(A,map,filename,'gif','LoopCount',Inf,'DelayTime',0.02);
% else
% imwrite(A,map,filename,'gif','WriteMode','append','DelayTime',0.02);
% end
% end