How can I separate these graphs?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Roger Stafford
2016년 4월 23일
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
Star Strider
2016년 4월 23일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Discrete Data Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!