plotting two x aes and 1 y axes for one plot

1 visualizzazione (ultimi 30 giorni)
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 Commenti
darova
darova il 13 Ott 2019
Did you try something?
priya
priya il 13 Ott 2019
I have editted the question to make the function simple. I am unable to plot the 2nd x-axes.

Accedi per commentare.

Risposta accettata

darova
darova il 13 Ott 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)

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by