plotting two x aes and 1 y axes for one plot
2 次查看(过去 30 天)
显示 更早的评论
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?
采纳的回答
darova
2019-10-13
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)
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!