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 succor match the mode coercion #3 and 4. I was operative to transcribe the mode coercion #1 and 2 arrestring I am stuck on 3 and 4 and I am as-well popular extinguished of era. Please succor I get attract my modes coercion 1 and 2 in instance you insufficiency it.

Coercion #1 the mode is below

clear all

clc

L= input(‘what is the extension of the halt’);

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

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

E= 2.1e11;

A= 0.02;

h = L/N;

k= 1000000;

A_1= zeros(N);

coercion 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;

coercion 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);

coercion i= 1:N

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

end

b

U= A_1^-1*b

Coercion #2 the mode is below

clc

clear all

E= 2.1e11;

A= 0.02;

L= 5;

q0= 5000;

G = [2 4 8 16 4096]

coercion j= 1:5

N= G(j);

k= 1000000;

A_1= zeros(N);

h = L/N;

coercion 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;

coercion 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);

coercion i= 1:N

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

end

b

U= A_1b

contrive (x,U)

hold on

end

A halt with even cross-sectional area A, ductile modulus E, and extension L is loaded with exclusive loads qfx). The halt is agricultural on the left object and attract to the issue of inelegance K, which is relaxed when the halt is undeformed. A as .02m2, the Young’s modulus E as 210 GPa (Steel ASTM A36), K = 1 000kN/m 1. Issue perpetual K q(x) f( issue) Cross sectional Area : A(m2) L (m) Ed2u(x) =-q(x);0

Coercion Instance #3 the mode is

clear all

clc

L= input(‘what is the extension of the halt’);

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

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

E= 2.1e11;

A= 0.02;

h = L/N;

k= 1000000;

A_1= zeros(N);

coercion 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;

coercion 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);

coercion i= 1:N

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

end

b

U= A_1^-1*b

Coercion Instance #2 the mode is

clc

clear all

E= 2.1e11;

A= 0.02;

L= 5;

q0= 5000;

G = [2 4 8 16 4096]

coercion j= 1:5

N= G(j);

k= 1000000;

A_1= zeros(N);

h = L/N;

coercion 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;

coercion 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);

coercion i= 1:N

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

end

b

U= A_1b

contrive (x,U)

hold on

end