Question of how to calculate elongation of the three columns as a function of 𝑑
4 次查看(过去 30 天)
显示 更早的评论
Hi, my question is given below and I have solved the answer to find the forces and plotted the graph of Forces vs distance (as seen below). Can you somebody help me how I can continue my code to find the elongation of three columns as a function of d and plot the graph?

%Load P applied at a certain distance
p=40;
d=0:1:50;
%Elongation of three columns
lab=12;lcd=8;lgf=10;
%solving a system of three linear equations
for i=1:length(d)
A=[1 1 1;10 28 40;12*lab -30*lcd 18*lgf];
f=[-p;-d(i)*p;0];
l=inv(A)*f;
q(i,:)=l(:,1);
end
%PLotting a graph of Force AB veruses the distance
plot(d,q(:,1))
xlabel('d');
ylabel('force ');
title('FAB vs d');
figure
%PLotting a graph of Force CD veruses the distance
plot(d,q(:,2))
xlabel('d');
ylabel('force ');
title('FCD vs d');
figure
plot(d,q(:,3))
%PLotting a graph of Force GF veruses the distance
xlabel('d');
ylabel('force ');
title('FGF vs d');
% Max and min compression and tension forces of AB,CD & GF
for i=1:3
if(max(q(:,i))<=0)
t(i)=0;
else
t(i)=max(q(:,i));
end
if(min(q(:,i))>=0)
c(i)=0;
else
c(i)=min(q(:,i));
end
end
%Printing the values of compression and tension forces of AB, CD & GF
fprintf('In AB the max tension is %f and max compression is %f\n',t(1),c(1));
fprintf('In CD the max tension is %f and max compression is %f\n',t(2),c(2));
fprintf('In FG the max tension is %f and max compression is %f\n',t(3),c(3));
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!