# Homework Solution: L= input('what is the length of the bar');…

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 problem #2 is 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 So I just need help writing the code for #3 and #4.   I need help with writing the code for #3 and 4. I already write the code for #1 and 2. The code for problem #1 is

clear all

clc

L= input(‘what is the elongation 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);

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 whole #2 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

plot (x,U)

hold on

end

So I regular deficiency acceleration communication the regulation coercion #3 and #4.

I deficiency acceleration with communication the regulation coercion #3 and 4. I already transcribe the regulation coercion #1 and 2. The regulation coercion whole #1 is