Question

In: Civil Engineering

Can you provide a sample programming for 2D plane frame in MATLAB ?

Can you provide a sample programming for 2D plane frame in MATLAB ?

Solutions

Expert Solution

clear all

clc

format short

E=210e6;

I=9*10^-5;

A=1*10^-2;

L1=[sqrt(13),5,sqrt(13)];

theta=[atand(3/2) 0 360-atand(3/2)];

ndcon=[1 2;2 3;3 4];

rsdof=[1 2 3 10 11 12];

nelem = size(ndcon,1);

nodes = 4;

ndofn = 3;

nnode = 2;

tdofs = 12;

K=zeros(tdofs);

gstif=zeros(12,12);

for ielem = 1:nelem

    gbdof=[];

    a=A*E/L1(ielem);

    b=12*E*I/(L1(ielem))^3;

    c=b*L1(ielem)/2;

    d=(b*L1(ielem)^2)/3;

    e=d/2;

    C=cosd(theta(ielem));

    S=sind(theta(ielem));

    estif=[a 0 0 -a 0 0;

           0 b c 0 -b c;

           0 c d 0 -c e;

          -a 0 0 a 0 0;

           0 -b -c 0 b -c;

           0 c e 0 -c d];

       T=[C S 0 0 0 0;

           -S C 0 0 0 0;

           0 0 1 0 0 0;

           0 0 0 C S 0;

           0 0 0 -S C 0;

           0 0 0 0 0 1];

    elcon=ndcon(ielem,:);

for inode = 1:nnode

for idofn = 1:ndofn

            eldof = (elcon(inode)-1)*ndofn+idofn;

            gbdof= [gbdof, eldof];

end

end

    gstif(gbdof,gbdof) = gstif(gbdof,gbdof)+T'*estif*T;

end

gstif

w=5;

Ft=[20 (-w*5/2) -(w*25/12) 0 (-w*5/2) (w*25/12)];

force=[0 0 0 20 (-w*5/2) -(w*25/12) 0 (-w*5/2) (w*25/12) 0 0 0]';

activ = setdiff(1:tdofs,rsdof);

u=gstif(activ,activ)\force(activ);

U=[0;0;0;u;0;0;0]

F=gstif*U-[0 0 0 Ft 0 0 0]';

f=zeros(6,3);

for ielem = 1:nelem

    gbdof=[]; %global DOF

    a=A*E/L1(ielem);

    b=12*E*I/(L1(ielem))^3;

    c=b*L1(ielem)/2;

    d=(b*L1(ielem)^2)/3;

    e=d/2;

    C=cosd(theta(ielem));

    S=sind(theta(ielem));

    elcon=ndcon(ielem,:);

    estif=[a 0 0 -a 0 0;

           0 b c 0 -b c;

           0 c d 0 -c e;

          -a 0 0 a 0 0;

           0 -b -c 0 b -c;

           0 c e 0 -c d];

       T=[C S 0 0 0 0;

           -S C 0 0 0 0;

           0 0 1 0 0 0;

           0 0 0 C S 0;

           0 0 0 -S C 0;

           0 0 0 0 0 1];

for inode = 1:nnode

for idofn = 1:ndofn

            eldof = (elcon(inode)-1)*ndofn+idofn;

            gbdof= [gbdof, eldof];

end

end

       f(:,ielem)=estif*T*U(gbdof);

end

for ielem=1:nelem

x=[0,L1(ielem)];

y1=[-f(3,ielem),f(6,ielem)];

y2=[f(2,ielem),-f(5,ielem)];

y3=[-f(1,ielem),f(4,ielem)];

figure

plot(x,y1,x,y2,x,y3)

legend('BM','SF','AF')

title('member')

end

%OUTPUT

% gstif =

%

%    1.0e+05 *

%

%     1.8256    2.6658   -0.0726   -1.8256   -2.6658   -0.0726         0         0         0         0         0         0

%     2.6658    4.0471    0.0484   -2.6658   -4.0471    0.0484         0         0         0         0         0         0

%    -0.0726    0.0484    0.2097    0.0726   -0.0484    0.1048         0         0         0         0         0         0

%    -1.8256   -2.6658    0.0726    6.0256    2.6658    0.0726   -4.2000         0         0         0         0         0

%    -2.6658   -4.0471   -0.0484    2.6658    4.0653   -0.0030         0   -0.0181    0.0454         0         0         0

%    -0.0726    0.0484    0.1048    0.0726   -0.0030    0.3609         0   -0.0454    0.0756         0         0         0

%          0         0         0   -4.2000         0         0    6.0256   -2.6658    0.0726   -1.8256    2.6658   0.0726

%          0         0         0         0   -0.0181   -0.0454   -2.6658    4.0653    0.0030    2.6658   -4.0471    0.0484

%          0         0         0         0    0.0454    0.0756    0.0726    0.0030    0.3609   -0.0726   -0.0484    0.1048

%          0         0         0         0         0         0   -1.8256    2.6658   -0.0726    1.8256   -2.6658   -0.0726

%          0         0         0         0         0         0    2.6658   -4.0471   -0.0484   -2.6658    4.0471   -0.0484

%          0         0         0         0         0         0    0.0726    0.0484    0.1048   -0.0726   -0.0484    0.2097

%

% U =

%          0

%          0

%          0

%     0.0013

%    -0.0009

%    -0.0005

%     0.0012

%     0.0008

%     0.0003

%          0

%          0

%          0


Related Solutions

Develop a general computer program using MATLAB for the analysis of plane (2D) frames. You can...
Develop a general computer program using MATLAB for the analysis of plane (2D) frames. You can use Chapter 6 as a reference. The program should be able to: a. Analyze a frame subjected to different load types, such as joint load, member load, and support displacement; b. Analyze frames with different boundary conditions: pin, roller, and fixed support; c. Generate the results including joint displacements, member axial, shear and moment forces, and reactions
Consider a sheet of 2d graphene in the x-y plane. The 2d sheet of graphene i...
Consider a sheet of 2d graphene in the x-y plane. The 2d sheet of graphene i then sut into a ribbon in the x direction. The energy becomes quantizes in the y direction. calcualte the  charge carrier energies E as a function of kx and ky.
creat a Matlab simulation the solves the 2D heat equation.
creat a Matlab simulation the solves the 2D heat equation.
32.) In the plane of a square conducting frame with the sides a= 8cm, there is...
32.) In the plane of a square conducting frame with the sides a= 8cm, there is an infinite long wire in a distance b= 0.5cm parallel with one side of the square. The infinite wire carries a current with the time functionI(t) = I0·cos(ωt), where I0= 3A,ω= 2pi·f and the frequency is f= 3MHz. a./ Find the mutual induction coefficient between the wire and the square. b./ Find the amplitude of the induced voltage.c./ Find the maximal magnetic flux in...
Write a C program to store the parameters of a circle on a 2D plane: the...
Write a C program to store the parameters of a circle on a 2D plane: the x and y coordinates of the center point and r, the radius. All three parameters are real (floating point) numbers. -Define a type to store the parameters of a circle. Write a function that receives the parameters of two circles as function parameters, and returns whether the two circles overlap or not. (Two circles overlap if the distance between their center points - computed...
I want the code for the 2D Ising model using Matlab
I want the code for the 2D Ising model using Matlab
Use R programming to resolve this; can you please provide details on the code? A) Create...
Use R programming to resolve this; can you please provide details on the code? A) Create a dataframe – comparativeGenomeSize with the following vectors: > organism<-c("Human","Mouse","Fruit Fly", "Roundworm","Yeast") > genomeSizeBP<-c(3000000000,3000000000,135600000,97000000,12100000) > estGeneCount<-c(30000,30000,13061,19099,6034) B) Print the organism and estGeneCount for Human and fruitfly.(1) C) Add a column to this data frame calculating base pairs per gene. To do this, write a function “genedensity” that takes as arguments the genomesizeBP and estimatedGeneCount information, and calculates from this the estimated bp per gene....
Engineering/ programming in MATLAB and it also involves a physics
Engineering/ programming in MATLAB and it also involves a physics
Define the following terms and provide an example for each: 1. Population 2. Sample frame 3....
Define the following terms and provide an example for each: 1. Population 2. Sample frame 3. Sample 4. Representative sample
C Programming Please write a single function and not the whole program Can you please provide...
C Programming Please write a single function and not the whole program Can you please provide comments and explanations for all questions. Thank you Write a single function for the following: void split_date(int day_of_year, int year, int *month, int *day);             day_of_year is an integer between 1 and 366, specifying a particular day within the year designated by the parameter year. Month and day point to variables in which the function will store the equivalent month (1 – 12) and day...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT