Borrar filtros
Borrar filtros

plotting two x aes and 1 y axes for one plot

1 visualización (últimos 30 días)
priya
priya el 13 de Oct. de 2019
Comentada: darova el 13 de Oct. de 2019
Drawing1.png
I made the function simple.
the code i have used is:
x1= [0: 0.1 : (2*pi*1)];
y=sin(x1);
plot (x1,y)
This helps me to plot the curve for magnitude vs time. I am unable to add the 'delta' x- axes?
  2 comentarios
darova
darova el 13 de Oct. de 2019
Did you try something?
priya
priya el 13 de Oct. de 2019
I have editted the question to make the function simple. I am unable to plot the 2nd x-axes.

Iniciar sesión para comentar.

Respuesta aceptada

darova
darova el 13 de Oct. de 2019
Example with two axes. Idea is from HERE
x1 = 0:0.1:40;
y1 = 4.*cos(x1)./(x1+2);
plot(x1,y1,'r')
ax1 = gca;
ax1_pos = get(ax1,'Position'); % position of first axes
% align second axes (transparent)
ax2 = axes('Position',ax1_pos,...
'Color','none');
ax1_pos(2) = ax1_pos(2) + 0.1; % move first axes up
ax1_pos(4) = ax1_pos(4) - 0.1; % make Ysize of axes smaller
set(ax1,'Position',ax1_pos)
set(ax2,'YTick',[]) % remove Y axis ticks
xlim(ax2,[0 5])
set(ax2,'XTick',0:2:5)
  2 comentarios
priya
priya el 13 de Oct. de 2019
yes it is working, thanks @darova
darova
darova el 13 de Oct. de 2019
You are welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by