How can I separate these graphs?
1 view (last 30 days)
Show older comments
Hi Everyone, I wrote this script and it works, also its plots. Now I would like to separate these graphs (they are overlapping). How can I do it? I don't think subplot is my answer. Thank you so much again!
clc
clear all
L=20; %m
A=25; %m^2
E=30000000; %KPa
m=1275000/L; %Kg/m
I=52.08; %m^4
betaL=[1.8751 4.6941 7.8548 10.996 14.1372];
beta=betaL./L; %normalize
omega=sqrt(beta.^4*E*I/m);
x=[0:0.1:20];
C1=0.005; %costant
for j=1:5
for i=1:length(x)
%displacements
Fi(i,j)=C1*(cosh(beta(j)*x(i))-cos(beta(j)*x(i))-(cosh(betaL(j))+cos(betaL(j)))/(sinh(betaL(j))+sin(betaL(j)))*(sinh(beta(j)*x(i))-sin(beta(j)*x(i))));
end
end
Z=zeros(length(x),1);
%plot
figure(1)
plot(Fi,x');
hold on;
plot(Z,x','k');
title('Displacement');
xlabel('u [m]');
ylabel('L [m]');
0 Comments
Answers (2)
Roger Stafford
on 23 Apr 2016
You have given 'plot' a 201 x 5 matrix, F1, to be plotted against a 201 x 1 column vector, x'. Under those circumstances 'plot' is supposed to give you five different 2D plots on the same graph, and they must necessarily overlap. If you want them to appear on separate graphs, then give each column, F1(:,j), to be plotted against x' for separate graphs, one at a time for each of the five values of j.
0 Comments
Star Strider
on 23 Apr 2016
Use the subplot function:
%plot
figure(1)
subplot(2,1,1)
plot(Fi,x');
title('Displacement');
xlabel('u [m]');
ylabel('L [m]');
subplot(2,1,2)
plot(Z,x','k');
title('Displacement');
xlabel('u [m]');
ylabel('L [m]');
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!