Borrar filtros
Borrar filtros

How can I separate these graphs?

1 visualización (últimos 30 días)
Roberto Antonino Ruggeri
Roberto Antonino Ruggeri el 23 de Abr. de 2016
Respondida: Star Strider el 23 de Abr. de 2016
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]');

Respuestas (2)

Roger Stafford
Roger Stafford el 23 de Abr. de 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.

Star Strider
Star Strider el 23 de Abr. de 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]');

Categorías

Más información sobre Discrete Data Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by