How to make a global matrix

27 次查看(过去 30 天)
Robert Fields
Robert Fields 2022-9-17
I am trying to make a global matrix out of these 4 matrices and then slim it down to the correct matrix for a stiffness problem.
close all
clear all
clc
E = 5.*10.^6;
v = .29;
A1 = 0.5;
A2 = 0.375;
A3 = 0.25;
A4 = 0.124;
%element 1
el1 = A1*E/30
a = [el1 0 -el1 0
0 0 0 0
-el1 0 el1 0
0 0 0 0]
%element 2
el2 = A2*E/31.6228
l1 = 0.948711;
m1 = 0.316146;
b = el2.*[l1^2 l1*m1 -l1^2 -l1*m1
l1*m1 m1^2 -l1*m1 -m1^2
-l1^2 -l1*m1 l1^2 l1*m1
-l1*m1 -m1^2 l1*m1 m1^2]
%element 3
el3 = A3*E/36.055
l2 = 0.832051;
m2 = 0.554699;
c = el3.*[l2^2 l2*m2 -l2^2 -l2*m2
l2*m2 m2^2 -l2*m2 -m2^2
-l2^2 -l2*m2 l2^2 l2*m2
-l2*m2 -m2^2 l2*m2 m2^2]
%element 4
el4 = A4.*E./42.4264
l3 = 0.707107;
m3 = 0.707107;
d = el4*[l3^2 l3*m3 -l3^2 -l3*m3
l3*m3 m3^2 -l3*m3 -m3^2
-l3^2 -l3*m3 l3^2 l3*m3
-l3*m3 -m3^2 l3*m3 m3^2]
%global system
  3 个评论
Robert Fields
Robert Fields 2022-9-18
编辑:Robert Fields 2022-9-18
By sliim it down I meant to a 4x4 or 6x6 matrix.
William Rose
William Rose 2022-9-18
@Robert Fields, you can create a 4x4 or 6x6 array and populate it with the elements you want from the 4x4x4 array.
e1=zeros(4,4); e2=zeros(6,6);
and so on. If all you really want is a 4x4 or 6x6 array made of selected elements of a, b, c, d, then I don't see the advantage of combing a,b,c,d into one 3D array. But I'm sure there's a reason...

请先登录,再进行评论。

回答(1 个)

William Rose
William Rose 2022-9-18
%global system
e=cat(3,a,b,c,d);
disp(size(e))
Try that.

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by