Ich bin fast neu in MATLAB. Ich weiß genau nicht, wie ich meinen Code so ändern kann, dass er korrekt funktioniert. Hier ist der Code, bei dem es darum geht, einen 3D-Träger mit zusätzlicher Last an einem speziellen Punkt zu analysieren.Wie wird der Code in DYNAMIC LOAD geändert?
function D=DataT3D
%m number of elements
%n number of nodes
m=25;n=10;
%coordinates of nodes [(X Y Z) for each node]
Coord=[-37.5 0 200;37.5 0 200;-37.5 37.5 100;37.5 37.5 100;37.5 -37.5
100;-37.5 -37.5 100;
-100 100 0;100 100 0;100 -100 0;-100 -100 0];
%conection of the nodes [first in coordinates is the first node and ...]
Con=[1 2;1 4;2 3;1 5;2 6;2 4;2 5;1 3;1 6;3 6;4 5;3 4;5 6;3 10;6 7;4 9;5 8;4
7;3 8;5 10;6 9;
6 10;3 7;4 8;5 9]; Con(:,3:4)=0;
%Re degrees of freedom for each node (free=0 & fixed=1)
Re=ones(n,6);
Re(1:6,1:3)=zeros(6,3);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% concentrated loads on nodes
Load=zeros(n,6);
Load([1,2,3,6],1:3)=[1 -10 -10;0 -10 -10;0.5 0 0;0.6 0 0];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% uniform loads in local coordinate system
w=zeros(m,3);
% E: material elastic modules G:shear elastic modules J:torsional constant
E=ones(1,m)*1e4;nu=0.3;G=E/(2*(1+nu));
% A:cross sectional area and Iy Iz: moment of inertia
A=ones(1,m)*0.5;Iz=ones(1,m);Iy=ones(1,m);J=ones(1,m);
%St: settlement of supports & displacements of free nodes
St=zeros(n,6); be=zeros(1,m);
% All of the variables are transposed and stored in a structure array in the
name of D
D=struct('m',m,'n',n,'Coord',Coord','Con',Con','Re',Re',...
'Load',Load','w',w','E',E','G',G','A',A','Iz',Iz','Iy',...
Iy','J',J','St',St','be',be');
end
Dieser Code wird mit einem anderen Code als Funktion ausgeführt.
function [Q,V,R]=MSA(D);
m=D.m;
n=D.n;
% the matrix to store K*T for each member 12*12*m
Ni=zeros(12,12,m);
% global stiffness matrix of the structure 6n*6n
S=zeros(6*n);
% element fixed end forces in global coordinate 6n*1
Pf=S(:,1);
% internal forces and moments in local coordinate system for each member
% 12*m
Q=zeros(12,m);
% element fixed end forces in local coordinate for each member 12*m
Qfi=Q;
% member code numbers* (mcn) in global stiffness matrix for each member
% 12*m
Ei=Q;
for i=1:m
% connectivity and release of the both member ends 4*1
H=D.Con(:,i);
% difference of beginning and end nodes coordinates 3*1
C=D.Coord(:,H(2))-D.Coord(:,H(1));
% member code numbers (mcn) in global stiffness matrix for a member
% 1*12
e=[6*H(1)-5:6*H(1),6*H(2)-5:6*H(2)];
c=D.be(i);
[a,b,L]=cart2sph(C(1),C(3),C(2));
ca=cos(a); sa=sin(a); cb=cos(b); sb=sin(b); cc=cos(c); sc=sin(c);
r=[1 0 0;0 cc sc;0 -sc cc]*[cb sb 0;-sb cb 0;0 0 1]*[ca 0 sa;0 1 0;-sa 0
ca];
% transformation matrix related to the
% coordinate transformation which in considering member orientation
% 12*12
T=kron(eye(4),r);
co=2*L*[6/L 3 2*L L];
x=D.A(i)*L^2; y=D.Iy(i)*co; z=D.Iz(i)*co;
g=D.G(i)*D.J(i)*L^2/D.E(i);
% local stiffness matrix for each member
K1=diag([x,z(1),y(1)]);
K2=[0 0 0;0 0 z(2);0 -y(2) 0];
K3=diag([g,y(3),z(3)]);
K4=diag([-g,y(4),z(4)]);
K=D.E(i)/L^3*[K1 K2 -K1 K2;K2' K3 -K2' K4;-K1 -K2 K1 -K2;K2' K4 -K2' K3];
% uniform loads in local coordinate system for each member 1*3
w=D.w(:,i)';
% local fixed-end force vector for a member, corresponding to external
% loads 12*1
Qf=-L^2/12*[6*w/L 0 -w(3) w(2) 6*w/L 0 w(3) -w(2)]';
% local fixed-end force vector for a member, corresponding to support
% displacements 12*1
Qfs=K*T*D.St(e)';
A=diag([0 -0.5 -0.5]);
B(2,3)=1.5/L;
B(3,2)=-1.5/L;
W=diag([1,0,0]);
Z=zeros(3);
M=eye(12);
p=4:6;
q=10:12;
% type of member release* 0 1 2 3
% M: A matrix for modifying stiffness matrix and local fixed-end force
vector of a released member ends such K=M*K , Qf=M*Qf and Qfs=M*Qfs
switch 2*H(3)+H(4)
case 0;B=2*B/3; % released at both ends
M(:,[p,q])=[-B -B;W Z;B B;Z W];
case 1; % released at the beginning
M(:,p)=[-B;W;B;A];
case 2; % released at the end
M(:,q)=[-B;A;B;W];
end
K=M*K;Ni(:,:,i)=K*T;
% global stiffness matrix of the structure 6n*6n
S(e,e)=S(e,e)+T'*Ni(:,:,i);
Qfi(:,i)=M*Qf;
% element fixed end forces in global coordinate 6n*1
Pf(e)=Pf(e)+T'*M*(Qf+Qfs);
% member code numbers* (mcn) in global stiffness matrix for each member
% 12*m
Ei(:,i)=e;
end
% Deflections in global coordinate syste 6*n
V=1-(D.Re|D.St);
% f: A vector that indicates the number of degree of freedom ndof*1
f=find(V);
V(f)=S(f,f)\(D.Load(f)-Pf(f));
% Supports reactions in global coordinate system 6*n
R=reshape(S*V(:)+Pf,6,n);
R(f)=0;V=V+D.St;
for i=1:m
% internal forces and moments in local coordinate system 12*m
Q(:,i)=Ni(:,:,i)*V(Ei(:,i))+Qfi(:,i);
end
So ist hier die Frage , wie die Last auf eine dynamische Form ändern? Jetzt ist der Code statisch. Es bedeutet nun, dass wir eine konzentrierte Last auf einen Knoten legen, und wir erhalten die Antwort, die zum Beispiel die Verschiebung anderer Knoten basierend auf der hinzugefügten konzentrierten Last ist. Aber wie können wir es in eine dynamische Form der Last ändern, was bedeutet, dass wir eine Last mit verschiedenen Werten in der Zeit (ex 5 Sekunden) zu einem Knoten hinzufügen und die Antwort anderer Knoten in verschiedenen Zeitschritten erhalten.
Sie können den zweiten Code auszuführen:
D = DataT3D; [Q, V, R] = MSA (D); **
Hilfe benötigt.
Kommentare sind nicht für längere Diskussionen; Diese Konversation wurde [in den Chat verschoben] (http://chat.stackoverflow.com/rooms/151146/discussion-on-answer-by-tina-how-to-change-the-code-to-dynamic-load) . – Undo