How to make a global matrix

조회 수: 17(최근 30일)
Robert Fields
Robert Fields 2022년 9월 17일
댓글: William Rose 2022년 9월 18일
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
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.

범주

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by