Filter löschen
Filter löschen

plotting two x aes and 1 y axes for one plot

1 Ansicht (letzte 30 Tage)
priya
priya am 13 Okt. 2019
Kommentiert: darova am 13 Okt. 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 Kommentare
darova
darova am 13 Okt. 2019
Did you try something?
priya
priya am 13 Okt. 2019
I have editted the question to make the function simple. I am unable to plot the 2nd x-axes.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

darova
darova am 13 Okt. 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 Kommentare
priya
priya am 13 Okt. 2019
yes it is working, thanks @darova
darova
darova am 13 Okt. 2019
You are welcome!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by