 # Linear Systems in Matlab

## Question

Suppose a string is stretched with tension τ horizontally between two anchors at x = 0 and x = 1. At each of the n − 1 equally spaced positions xk = k/n, k = 1, . . . , n − 1, we attach a little mass mi and allow the string to come to equilibrium. This causes vertical displacement of the string. Let qk be the amount of displacement at xk. If the displacements are not too large, then an approximate force balance equation is nτ(qk − qk−1) + nτ(qk − qk+1) = mkg, k = 1, . . . , n − 1, where g = −9.8 m/s² is the acceleration due to gravity, and we naturally define q0 = 0 and qn = 0 due to the anchors.

(a) Show that the force balance equations can be written as a linear system Aq = f, where q is a vector of displacements and A is a tridiagonal matrix (i. e., aij = 0 if |i − j| > 1) of size (n − 1) × (n − 1).

(b) Let τ = 10 N, and mk = (1/10n) kg for every k. Find the displacements in MATLAB when n = 4 and n = 40, and superimpose plots of q over 0 ≤ x ≤ 1 for the two cases. (Be sure to include the zero values at x = 0 and x = 1 in your plots of the string.)

c) Repeat (b) for the case mk = (k/5n²) kg.

## Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

function Solution()

n1=4;
A=diag(2*ones(1,n1-1))+diag(-1*ones(1,n1-2),-1)+diag(-1*ones(1,n1-2),1);
mk=(1/10/n1);
tau=10;g=-9.8;
f=mk*g/(n1*tau)*ones(1,n1-1)';
q=A\f;
Q1=[0,q',0];
n2=40;
A=diag(2*ones(1,n2-1))+diag(-1*ones(1,n2-2),-1)+diag(-1*ones(1,n2-2),1);
mk=(1/10/n2);
tau=10;g=-9.8;
f=mk*g/(n2*tau)*ones(1,n2-1)';
q=A\f;
Q2=[0,q',0];
plot(0:1/n1:1,Q1,0:1/n2:1,Q2);
str1 = '\leftarrow point of attach fixed';
str2 = '\rightarrow point of attach fixed';
text(0,0,str1)
text(1,0,str2)
legend('n=4','n=40')
xlabel('position')
ylabel('Displacement')
% Variant masses

n1=4;
A=diag(2*ones(1,n1-1))+diag(-1*ones(1,n1-2),-1)+diag(-1*ones(1,n1-2),1);
mk=(1/10/n1);
tau=10;g=-9.8;
f=zeros(n1-1,1);
for k=1:n1-1...
\$83.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.