필터 지우기
필터 지우기

How can I separate these graphs?

조회 수: 1 (최근 30일)
Roberto Antonino Ruggeri
Roberto Antonino Ruggeri 2016년 4월 23일
답변: Star Strider 2016년 4월 23일
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]');

답변 (2개)

Roger Stafford
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.

Star Strider
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]');

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by