How to make a global matrix

19 views (last 30 days)
Robert Fields
Robert Fields on 17 Sep 2022
Commented: William Rose on 18 Sep 2022
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
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
William Rose
William Rose on 18 Sep 2022
@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...

Sign in to comment.

Answers (1)

William Rose
William Rose on 18 Sep 2022
%global system
Try that.


Find more on Creating and Concatenating Matrices in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!