I need help writing the code for #3 and 4. I was able to write the code for #1 and 2 but I am stuck on 3 and 4 and I am also running out of time. Please help I will attach my codes for 1 and 2 in case you need it.
For #1 the code is below
clear all
clc
L= input('what is the length of the bar');
N= input('what is the number of intervals ');
q0= input('what is this value');
E= 2.1e11;
A= 0.02;
h = L/N;
k= 1000000;
A_1= zeros(N);
for c=2:N-1
A_1(c,c)=-2;
A_1(c,c-1)=1;
A_1(c,c+1)=1;
end
A_1(N,N-1)=2;
A_1(1,1)=-2;
A_1 (1,2)= 1;
A_1(N,N)=-2-2*h*k/(A*E);
A_1;
x= h:h:L;
for i= 1:N
if x(i)<= L/2
q(i)= q0*((2*x(i))^2)/L^2;
else
q(i)=q0*(2-2*x(i)/L);
end
end
A_1
q
b= zeros(N,1);
for i= 1:N
b(i)= - ((h^2)*q(i)/(E*A));
end
b
U= A_1^-1*b
For #2 the code is below
clc
clear all
E= 2.1e11;
A= 0.02;
L= 5;
q0= 5000;
G = [2 4 8 16 4096]
for j= 1:5
N= G(j);
k= 1000000;
A_1= zeros(N);
h = L/N;
for c=2:N-1
A_1(c,c)=-2;
A_1(c,c-1)=1;
A_1(c,c+1)=1;
end
A_1(N,N-1)=2;
A_1(1,1)=-2;
A_1 (1,2)= 1;
A_1(N,N)=-2-2*h*k/(A*E);
A_1
x= h:h:L;
for i= 1:N
if x(i)<= L/2
q(i)= q0*(2*x(i))^2/L^2;
else
q(i)=q0*(2-2*x(i)/L);
end
end
A_1
q
b= zeros(N,1);
for i= 1:N
b(i)= - ((h^2)*q(i)/(E*A));
end
b
U= A_1b
plot (x,U)
hold on
end

A bar with uniform cross-sectional area A, elastic modulus E, and length L is loaded with distributed loads qfx). The bar is fixed on the left end and attach to the spring of stiffness K, which is relaxed when the bar is undeformed. A as .02m2, the Young's modulus E as 210 GPa (Steel ASTM A36), K = 1 000kN/m 1. Spring constant K q(x) f( spring) Cross sectional Area : A(m2) L (m) Ed2u(x) =-q(x);0
For Case #3 the code is
clear all

I insufficiency acceleration fitness the order control #3 and 4. I was talented to transcribe the order control #1 and 2 excepting I am accumulate on 3 and 4 and I am as-well ordinary extinguished of date. Please acceleration I conciliate subjoin my orders control 1 and 2 in condition you insufficiency it.

Control #1 the order is below

clear all

clc

L= input(‘what is the prolixity of the cease’);

N= input(‘what is the reckon of intervals ‘);

q0= input(‘what is this value’);

E= 2.1e11;

A= 0.02;

h = L/N;

k= 1000000;

A_1= zeros(N);

control c=2:N-1

A_1(c,c)=-2;

A_1(c,c-1)=1;

A_1(c,c+1)=1;

end

A_1(N,N-1)=2;

A_1(1,1)=-2;

A_1 (1,2)= 1;

A_1(N,N)=-2-2*h*k/(A*E);

A_1;

x= h:h:L;

control i= 1:N

if x(i)<= L/2

q(i)= q0*((2*x(i))^2)/L^2;

else

q(i)=q0*(2-2*x(i)/L);

end

end

A_1

q

b= zeros(N,1);

control i= 1:N

b(i)= – ((h^2)*q(i)/(E*A));

end

b

U= A_1^-1*b

Control #2 the order is below

clc

clear all

E= 2.1e11;

A= 0.02;

L= 5;

q0= 5000;

G = [2 4 8 16 4096]

control j= 1:5

N= G(j);

k= 1000000;

A_1= zeros(N);

h = L/N;

control c=2:N-1

A_1(c,c)=-2;

A_1(c,c-1)=1;

A_1(c,c+1)=1;

end

A_1(N,N-1)=2;

A_1(1,1)=-2;

A_1 (1,2)= 1;

A_1(N,N)=-2-2*h*k/(A*E);

A_1

x= h:h:L;

control i= 1:N

if x(i)<= L/2

q(i)= q0*(2*x(i))^2/L^2;

else

q(i)=q0*(2-2*x(i)/L);

end

end

A_1

q

b= zeros(N,1);

control i= 1:N

b(i)= – ((h^2)*q(i)/(E*A));

end

b

U= A_1b

devise (x,U)

hold on

end

A cease with homogeneous cross-sectional area A, extensile modulus E, and prolixity L is loaded with distributed loads qfx). The cease is unwandering on the left object and subjoin to the leap of slang K, which is relaxed when the cease is undeformed. A as .02m2, the Young’s modulus E as 210 GPa (Steel ASTM A36), K = 1 000kN/m 1. Leap continuous K q(x) f( leap) Cross sectional Area : A(m2) L (m) Ed2u(x) =-q(x);0

Control Condition #3 the order is

clear all

clc

L= input(‘what is the prolixity of the cease’);

N= input(‘what is the reckon of intervals ‘);

q0= input(‘what is this value’);

E= 2.1e11;

A= 0.02;

h = L/N;

k= 1000000;

A_1= zeros(N);

control c=2:N-1

A_1(c,c)=-2;

A_1(c,c-1)=1;

A_1(c,c+1)=1;

end

A_1(N,N-1)=2;

A_1(1,1)=-2;

A_1 (1,2)= 1;

A_1(N,N)=-2-2*h*k/(A*E);

A_1;

x= h:h:L;

control i= 1:N

if x(i)<= L/2

q(i)= q0*((2*x(i))^2)/L^2;

else

q(i)=q0*(2-2*x(i)/L);

end

end

A_1

q

b= zeros(N,1);

control i= 1:N

b(i)= – ((h^2)*q(i)/(E*A));

end

b

U= A_1^-1*b

Control Condition #2 the order is

clc

clear all

E= 2.1e11;

A= 0.02;

L= 5;

q0= 5000;

G = [2 4 8 16 4096]

control j= 1:5

N= G(j);

k= 1000000;

A_1= zeros(N);

h = L/N;

control c=2:N-1

A_1(c,c)=-2;

A_1(c,c-1)=1;

A_1(c,c+1)=1;

end

A_1(N,N-1)=2;

A_1(1,1)=-2;

A_1 (1,2)= 1;

A_1(N,N)=-2-2*h*k/(A*E);

A_1

x= h:h:L;

control i= 1:N

if x(i)<= L/2

q(i)= q0*(2*x(i))^2/L^2;

else

q(i)=q0*(2-2*x(i)/L);

end

end

A_1

q

b= zeros(N,1);

control i= 1:N

b(i)= – ((h^2)*q(i)/(E*A));

end

b

U= A_1b

devise (x,U)

hold on

end