matlab
CEE210_CP2_Beam_Template (1).m
%% ----------------------------------------------------------------- %.... Name: %.... Date: %.... Project: %.... Recitation Section: %----------------------------------------------------------------- % Computing project 2 studies the placement of a load at various % points along a beam and how this affects the support reactions clear; clc; %% Print Banner to command window fprintf('%s\n','*-----------------------------------------*') fprintf('%s\n','| CEE210 Computing Project 2 |') fprintf('%s\n','| Amie Baisley |') fprintf('%s\n','| Original Version: 09.10.2013 |') fprintf('%s\n','| Modified by: Chris Lawrence 2.10.2016 |') fprintf('%s\n','*-----------------------------------------*') % Units used: N, m % Input physical problem data P = 1000; % magnitude of point load applied to the bar L = 6; % length of the bar T1 = 0; % variable name for tension in cable AB T2 = 0; % variable name for tension in cable CD Ro = [0,0,0]; % variable name for reaction at O rAB = [-6;-2;3]; % direction vector from A to B rCD = [-3;4;0]; % direction vector from C to D n = [-6/7;-2/7;3/7]; % unit vector describing the direction of T1 m = [-3/5;4/5;0]; % unit vector describing the direction of T2 e1 =[1;0;0]; % base vector e1 e2 = [0;1;0]; % base vector e2 e3 = [0;0;1]; % base vector e3 % Set up a history array to save results computed nitems = 4; % total number of items stored in history nreport = 12; % number of items to report history = zeros(nreport,nitems); % initialize storage for history % Set up any cross products needed for analysis a = cross(e1,n) b = cross(e1,m) c = cross(e1,e3) % Variables needed for running the loops x=0; %variable describing where P is placed i=1; %variable used for storage location in history %% While loop to go through increments along the length of the bar while (x<=6) % Your derived equations for tension AB and CD and the reaction at O % should be implemented here % The ratio of the magnitude of the reaction should also be computed % and the variable name "Ratio" can be used history(i,:) = [x,T1,T2,Ratio] x=x+3; i=i+1; end %% Create the plot fig=figure(1); clf; grid on; hold on; xlabel('Distance x'); ylabel('Tension'); title('Tension vs. X-distance'); p = plot(history(:,1),history(:,2)); set(p,'Color','blue','LineWidth',4); p = plot(history(:,1),history(:,3)); set(p,'Color','green','LineWidth',4);