Extracting Data from Figures and Vectors
Dear all,
I have the following code in which I want to extracxt y values (displacements) for 12ft, 24ft and 36ft along a 48ft beam.
clear, clc, close all
EI = 29000*13400; % Flexural rigidity
L = 48; % Length of Beam
P = 1; % Loading
R1y = 0.75; % Support reaction at support 1
R2y = 0.25; % Support reaction at support 2
x1 = 0:0.1:12; % X values for 0 < x < 12
dx1 = x1(2) – x1(1); % Step size
x2 = 12:0.1:48; % X values for 0 < x < 12
Mx1 = R1y*x1/(EI); % Moment function for x1
dx2 = x2(2) – x2(1); % Step size
Mx2 = (R1y*x2 – P*(x2-12))/(EI); % Moment function for x2
y1(1) = 0; % Initial condition for y1
b = 36;
z1(1) = P*b*(L^2 – b^2)/(6*L*EI); % Initial condition for z1 (slope)
% Compute displacement for 0 < x1 < 12
for i = 1:length(x1)-1
y1(i+1) = y1(i) + z1(i)*dx1;
z1(i+1) = z1(i) – Mx1(i)*dx1;
end
y2(1) = y1(end) % Initial condition for y2
z2(1) = z1(end) % Initial condition for z2 (slope)
% Compute displacement for 12 < x2 < 48
for i = 1:length(x2)-1
y2(i+1) = y2(i) + z2(i)*dx2;
z2(i+1) = z2(i) – Mx2(i)*dx2;
end
% Plot results
plot(x1,y1,x2,y2)
grid on
My y1 vector is 121 interations long and my y2 vector is 361 iterations long. How do I extract from the data the values at 12ft, 24ft and 36ft of the beam in the most efficient way? If for example I put y1(12) I do not get the value at 12ft along the 48ft beam, because I have made a step size 0.1 and not 1.
Many thanks in advance,
ScottDear all,
I have the following code in which I want to extracxt y values (displacements) for 12ft, 24ft and 36ft along a 48ft beam.
clear, clc, close all
EI = 29000*13400; % Flexural rigidity
L = 48; % Length of Beam
P = 1; % Loading
R1y = 0.75; % Support reaction at support 1
R2y = 0.25; % Support reaction at support 2
x1 = 0:0.1:12; % X values for 0 < x < 12
dx1 = x1(2) – x1(1); % Step size
x2 = 12:0.1:48; % X values for 0 < x < 12
Mx1 = R1y*x1/(EI); % Moment function for x1
dx2 = x2(2) – x2(1); % Step size
Mx2 = (R1y*x2 – P*(x2-12))/(EI); % Moment function for x2
y1(1) = 0; % Initial condition for y1
b = 36;
z1(1) = P*b*(L^2 – b^2)/(6*L*EI); % Initial condition for z1 (slope)
% Compute displacement for 0 < x1 < 12
for i = 1:length(x1)-1
y1(i+1) = y1(i) + z1(i)*dx1;
z1(i+1) = z1(i) – Mx1(i)*dx1;
end
y2(1) = y1(end) % Initial condition for y2
z2(1) = z1(end) % Initial condition for z2 (slope)
% Compute displacement for 12 < x2 < 48
for i = 1:length(x2)-1
y2(i+1) = y2(i) + z2(i)*dx2;
z2(i+1) = z2(i) – Mx2(i)*dx2;
end
% Plot results
plot(x1,y1,x2,y2)
grid on
My y1 vector is 121 interations long and my y2 vector is 361 iterations long. How do I extract from the data the values at 12ft, 24ft and 36ft of the beam in the most efficient way? If for example I put y1(12) I do not get the value at 12ft along the 48ft beam, because I have made a step size 0.1 and not 1.
Many thanks in advance,
Scott Dear all,
I have the following code in which I want to extracxt y values (displacements) for 12ft, 24ft and 36ft along a 48ft beam.
clear, clc, close all
EI = 29000*13400; % Flexural rigidity
L = 48; % Length of Beam
P = 1; % Loading
R1y = 0.75; % Support reaction at support 1
R2y = 0.25; % Support reaction at support 2
x1 = 0:0.1:12; % X values for 0 < x < 12
dx1 = x1(2) – x1(1); % Step size
x2 = 12:0.1:48; % X values for 0 < x < 12
Mx1 = R1y*x1/(EI); % Moment function for x1
dx2 = x2(2) – x2(1); % Step size
Mx2 = (R1y*x2 – P*(x2-12))/(EI); % Moment function for x2
y1(1) = 0; % Initial condition for y1
b = 36;
z1(1) = P*b*(L^2 – b^2)/(6*L*EI); % Initial condition for z1 (slope)
% Compute displacement for 0 < x1 < 12
for i = 1:length(x1)-1
y1(i+1) = y1(i) + z1(i)*dx1;
z1(i+1) = z1(i) – Mx1(i)*dx1;
end
y2(1) = y1(end) % Initial condition for y2
z2(1) = z1(end) % Initial condition for z2 (slope)
% Compute displacement for 12 < x2 < 48
for i = 1:length(x2)-1
y2(i+1) = y2(i) + z2(i)*dx2;
z2(i+1) = z2(i) – Mx2(i)*dx2;
end
% Plot results
plot(x1,y1,x2,y2)
grid on
My y1 vector is 121 interations long and my y2 vector is 361 iterations long. How do I extract from the data the values at 12ft, 24ft and 36ft of the beam in the most efficient way? If for example I put y1(12) I do not get the value at 12ft along the 48ft beam, because I have made a step size 0.1 and not 1.
Many thanks in advance,
Scott figures, for loop, vectors MATLAB Answers — New Questions