Borrar filtros
Borrar filtros

How we can use matrixes as a variables in a loop?

2 visualizaciones (últimos 30 días)
Elyar Ghaffarian Dallali
Elyar Ghaffarian Dallali el 3 de Dic. de 2022
Comentada: Jan el 4 de Dic. de 2022
I have a MATLAB code calculating four types of matrixes which are time dependent.
close all
clear all
clc
% FIRST HARMONIC OF WALKING PROPERTIES
% Dynamic Load = Shape function*A1.cos(B1.t+phi) , A1=W*DLF, B1=2*pi*k*fp,
% k=1 (First Harmonic), phi=0 (First Harmonic)
phi1 = 0;
load A1.mat
%B=2*pi*k*fp
load B1.mat
% V = 0.714*fs+0.055 (Velocity of Pedestrian Loading)
load V.mat
digits(2)
format shortEng
syms G1
syms t
G1 = vpa([sin(pi.*V.*t/22.9).*A1.*cos(B1.*t)],2);
%%
% MODAL PROPERTIES OF THE BEAM:
syms x
m1 = 1735*int((sin((pi*x)/22.9))^2, 0, 22.9);
% NORMALIZED MODE SHAPE:
syms phi(x)
phi(x) = sin(pi*x/22.9)/sqrt(m1);
%NORMALIZED MODAL MASS:
m = 1735*int(phi(x)^2, 0, 22.9);
% MODAL FORCE:
digits(2)
syms f1(t)
f1(t) = G1.*phi(V.*t);
% fplot(f1(t), [0,20]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Bridge First Vertical Modal Damping Ratio:
kisi = 0.008;
% First Modal Frequency of the Beam:
omega = 8.8*pi;
%%
% MODAL PROPERTIES:
% BODY MASS:
load mp.mat
% BODY STIFFNESS:
load kp.mat
% BODY DAMPING:
load cp.mat
for i=1:1:length(mp)
m = vpa([1, mp(i,:).*phi(V(i,:)*t); 0, mp(i,:)])
k = vpa([omega^2, 0; -kp(i,:).*phi(V(i,:)*t), kp(i,:)])
c = vpa([2*kisi*omega, 0; -cp(i,:).*phi(V(i,:)*t), cp(i,:)]);
Q = vpa([G1(i,:).*phi(V(i,:)*t); 0]);
end
It is worth noting that cp, kp, mp, A1, B1, and V are vectors defined as follows;
A1=
326.673000000000
402.442987500000
478.212975000000
553.982962500000
613.125000000000
277.018704000000
341.271653400000
405.524602800000
469.777552200000
519.930000000000
224.751024000000
276.880775400000
329.010526800000
381.140278200000
421.830000000000
201.230568000000
247.904880300000
294.579192600000
341.253504900000
377.685000000000
182.936880000000
225.368073000000
267.799266000000
310.230459000000
343.350000000000
182.936880000000
225.368073000000
267.799266000000
310.230459000000
343.350000000000
182.936880000000
225.368073000000
267.799266000000
310.230459000000
343.350000000000
167.256576000000
206.050809600000
244.845043200000
283.639276800000
313.920000000000
156.803040000000
193.172634000000
229.542228000000
265.911822000000
294.300000000000
154.189656000000
189.953090100000
225.716524200000
261.479958300000
289.395000000000
117.602280000000
144.879475500000
172.156671000000
199.433866500000
220.725000000000
B1=
10.4876000000000
11.5363600000000
12.5851200000000
13.6338800000000
14.6826400000000
10.4876000000000
11.5363600000000
12.5851200000000
13.6338800000000
14.6826400000000
10.4876000000000
11.5363600000000
12.5851200000000
13.6338800000000
14.6826400000000
10.4876000000000
11.5363600000000
12.5851200000000
13.6338800000000
14.6826400000000
10.4876000000000
11.5363600000000
12.5851200000000
13.6338800000000
14.6826400000000
10.4876000000000
11.5363600000000
12.5851200000000
13.6338800000000
14.6826400000000
10.4876000000000
11.5363600000000
12.5851200000000
13.6338800000000
14.6826400000000
10.4876000000000
11.5363600000000
12.5851200000000
13.6338800000000
14.6826400000000
10.4876000000000
11.5363600000000
12.5851200000000
13.6338800000000
14.6826400000000
10.4876000000000
11.5363600000000
12.5851200000000
13.6338800000000
14.6826400000000
10.4876000000000
11.5363600000000
12.5851200000000
13.6338800000000
14.6826400000000
V=
1.24738000000000
1.36661800000000
1.48585600000000
1.60509400000000
1.72433200000000
1.24738000000000
1.36661800000000
1.48585600000000
1.60509400000000
1.72433200000000
1.24738000000000
1.36661800000000
1.48585600000000
1.60509400000000
1.72433200000000
1.24738000000000
1.36661800000000
1.48585600000000
1.60509400000000
1.72433200000000
1.24738000000000
1.36661800000000
1.48585600000000
1.60509400000000
1.72433200000000
1.24738000000000
1.36661800000000
1.48585600000000
1.60509400000000
1.72433200000000
1.24738000000000
1.36661800000000
1.48585600000000
1.60509400000000
1.72433200000000
1.24738000000000
1.36661800000000
1.48585600000000
1.60509400000000
1.72433200000000
1.24738000000000
1.36661800000000
1.48585600000000
1.60509400000000
1.72433200000000
1.24738000000000
1.36661800000000
1.48585600000000
1.60509400000000
1.72433200000000
1.24738000000000
1.36661800000000
1.48585600000000
1.60509400000000
1.72433200000000
mp=
125
125
125
125
125
106
106
106
106
106
86
86
86
86
86
77
77
77
77
77
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
64
64
64
64
64
60
60
60
60
60
59
59
59
59
59
45
45
45
45
45
cp=
135
135
135
135
135
114.480000000000
114.480000000000
114.480000000000
114.480000000000
114.480000000000
92.8800000000000
92.8800000000000
92.8800000000000
92.8800000000000
92.8800000000000
83.1600000000000
83.1600000000000
83.1600000000000
83.1600000000000
83.1600000000000
75.6000000000000
75.6000000000000
75.6000000000000
75.6000000000000
75.6000000000000
75.6000000000000
75.6000000000000
75.6000000000000
75.6000000000000
75.6000000000000
75.6000000000000
75.6000000000000
75.6000000000000
75.6000000000000
75.6000000000000
69.1200000000000
69.1200000000000
69.1200000000000
69.1200000000000
69.1200000000000
64.8000000000000
64.8000000000000
64.8000000000000
64.8000000000000
64.8000000000000
63.7200000000000
63.7200000000000
63.7200000000000
63.7200000000000
63.7200000000000
48.6000000000000
48.6000000000000
48.6000000000000
48.6000000000000
48.6000000000000
kp =
405
405
405
405
405
343.440000000000
343.440000000000
343.440000000000
343.440000000000
343.440000000000
278.640000000000
278.640000000000
278.640000000000
278.640000000000
278.640000000000
249.480000000000
249.480000000000
249.480000000000
249.480000000000
249.480000000000
226.800000000000
226.800000000000
226.800000000000
226.800000000000
226.800000000000
226.800000000000
226.800000000000
226.800000000000
226.800000000000
226.800000000000
226.800000000000
226.800000000000
226.800000000000
226.800000000000
226.800000000000
207.360000000000
207.360000000000
207.360000000000
207.360000000000
207.360000000000
194.400000000000
194.400000000000
194.400000000000
194.400000000000
194.400000000000
191.160000000000
191.160000000000
191.160000000000
191.160000000000
191.160000000000
145.800000000000
145.800000000000
145.800000000000
145.800000000000
145.800000000000
As it is mentioned, in the above code, m, c, k, and Q are time dependent matrixes. In the following, I want to calculated eigen values of these time dependent matrixes for different time steps which has been mentioned in vector titled 't' defined as below:
t=
9.17923968638266
8.37834713138565
7.70599573579136
7.13353859649341
6.64025257317036
9.17923968638266
8.37834713138565
7.70599573579136
7.13353859649341
6.64025257317036
9.17923968638266
8.37834713138565
7.70599573579136
7.13353859649341
6.64025257317036
9.17923968638266
8.37834713138565
7.70599573579136
7.13353859649341
6.64025257317036
9.17923968638266
8.37834713138565
7.70599573579136
7.13353859649341
6.64025257317036
9.17923968638266
8.37834713138565
7.70599573579136
7.13353859649341
6.64025257317036
9.17923968638266
8.37834713138565
7.70599573579136
7.13353859649341
6.64025257317036
9.17923968638266
8.37834713138565
7.70599573579136
7.13353859649341
6.64025257317036
9.17923968638266
8.37834713138565
7.70599573579136
7.13353859649341
6.64025257317036
9.17923968638266
8.37834713138565
7.70599573579136
7.13353859649341
6.64025257317036
9.17923968638266
8.37834713138565
7.70599573579136
7.13353859649341
6.64025257317036
At the end of the day, I want to calculate the value of 'A' as an output vector of the final code associated with with all of the components of vector 't'
clear all;
close all;
m = [1.0, 0.89*sin(0.19*t); 0, 120.0];
k = [760, 0; -2.9*sin(0.19*t), 400] ;
c = [0.44, 0; -0.96*sin(0.17*t), 140 ];
mk = -m\k;
mc = -m\c;
B = [zeros(2), eye(2); mk, mc];
C = (1/(2*pi))*abs(eig(B)); % Calculating the Natural Frequency of the human_bridge system
A =C(1)
  2 comentarios
Dyuman Joshi
Dyuman Joshi el 4 de Dic. de 2022
Format your code properly.
Jan
Jan el 4 de Dic. de 2022
@Elyar Ghaffarian Dallali: Please clean up the question. The huge pile of blank space impedes the reading. In addition the question "use matrices as variables" is not clear.

Iniciar sesión para comentar.

Respuestas (0)

Productos


Versión

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by