Using plotyy my 2nd Y axis is not depending on X axis when I introduce limits to X axis.

1 Ansicht (letzte 30 Tage)
I have 2 Y axis (Y1 acceleration and Y2 Velocity), and 1 X axis (time) I am using plotyy to plot 2 curves
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1)
[ax,hlines(1),hlines(2)] = plotyy(t,Acc,t,Ve);
cfig = get(gcf,'color');
pos = [0.1 0.1 0.7 0.8];
offset = pos(3)/5.5;
xlabel('Time (ms)')
xlim([-80 60])
set(ax(1),'YLim',[-80 50])
set(ax(1),'YTick',[-80:20:50])
set(ax(2),'YLim',[-20 45])
set(ax(2),'YTick',[-20:10:45])
grid on
title('Test 01')
ylabel(ax(1),'Acceleration (g)');
ylabel(ax(2),'velocity (km/h)');
axis on
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The problem is my Y2 (Velocity) is not fixed with X axis. When i changed X limit "xlim([-80 60])" to "xlim([-80 20])" the Y2 (velocity) plot remains same size. But I need to zoom it in the particular interval.
Please help me.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by