clc clear all disp('PURPOSE') disp(' Example showing a use for matrices') % INPUT MATRICES % stiffness matrix [s] is in kips/inch s=[2 0.1 0.2; 0.1 0.002 2.1; 0.2 2.1 0.03] .*10^3; % convert the [s] matrix to lbs/in s=s*10^3; % force matrix [f] is in pounds f=[9200; 42100; 105630]; disp('INPUTS') disp(' Input stiffness matrix [s] (lbs/in)') disp(s) disp(' Input force matrix [f] (lbs)') disp(f) % CODE % using the relationship [f]=[k][x] we'll solve for [x] % displacment matrix is [x] (inches) x=inv(s)*f; % OUTPUTS disp('OUTPUTS') disp(' Output displacment matrix [x] (in)') disp(x) % finding the maximun displacement max_disp=max(x); fprintf(' The maximun displacement is %g in\n\n',max_disp)