Question: number, length, etc. ) 2 . Modify the above version of the code to allow for arbitrary prescribed displacement. Solve in matlab with 1 5

number, length, etc.)
2. Modify the above version of the code to allow for arbitrary prescribed displacement. Solve in matlab with 15 elements of equal length, but replace the force at node 3(in the figure above) by a displacement value of 0.1 mm and keep \( F_{2}\) unchanged. Solve the same problem by hand first as a 2-element problem for validation purpose, then solve it using Matlab. Provide the nodal displacements and reaction forces. ```
% This data will automatically describe a line of 2-node elements
clear;
numele=6; numnod=numele+1;
% x-coordinates of nodes
x=[0:1/numele:1];
% node stores the nodes of all the elements, i.e., element connectivity
node=[1:numele;2:numele+1];
area =[2.0*ones(1,numele)];
young =[1.E7*ones(1, numele)];
% support conditions, ifix (i)=1 if node i is fixed, else 0.
ifix=[1,zeros(1, numele)];
ifix(numnod)=1;
% externally applied loads
force=[10e\theta/numele*ones (1, numnod)];
%Initialize system matrix
bigk =[zeros(numnod, numnod)];
%
%Loop over elements
%
for e=1:numele
% compute element length
length = x(node(2,e))- x(node(1,e));
c = young(e)*area(e)/length;
% compute element stiffness matrix
```
```
bigk(node(1,e), node(1,e))=bigk(node(1,e), node(1,e))+ke(1,1);
bigk(node(1,e), node(2,e))=bigk(node(1,e), node(2,e))+ke(1,2);
bigk(node(2,e), node(1,e))=bigk(node(2,e), node(1,e))+ke(2,1);
bigk(node(2,e), node(2,e))=bigk(node(2,e), node(2,e))+ke(2,2);
end
for n=1:numnod
if(ifix(n)==1)
bigk(n,n)=1E+30;
force(n)=0;
end
end
%solve stiffness equations
disp=force/bigk;
%Plot displacements
subplot(211); plot(x,disp);
%title('10 FEM results Elem number:6');
xlabel('x');ylabel('Displacement');
% Plot stresses
for e=1:numele
length = x(node(2,e))- x(node(1,e));
elong = disp(node(2,e))- disp(node(1,e));
eps=elong/length;
sig(2*e-1)=young(e)*eps;
sig(2*e)= sig(2*e-1);
xx(2*e-1)= x(node(1,e));
xx}(\mp@subsup{2}{}{*}e)=x(\operatorname{node(2,e));
%yy(e)=(x(node(1,e))+x(node(2,e))/2
end
subplot(212); plot(xx,sig);
xlabel('x');ylabel('stress');
```
number, length, etc. ) 2 . Modify the above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!