フィルターのクリア

Using yyaxis how do I limit and select a range for the y and x axis?

75 ビュー (過去 30 日間)
Rebecca Ellis
Rebecca Ellis 2018 年 9 月 6 日
回答済み: Rebecca Ellis 2018 年 9 月 6 日
So far I have tried
ax1 = plot(t, x_velocity,'MarkerSize',10,'Marker','.','MarkerSize',8,'LineWidth',2,'Color',[0 0 0]);
hold on
plot(t, y_velocity,'MarkerSize',10,'Marker','.','MarkerSize',8,'LineWidth',2,'Color',[1 0 0]);
plot(t, z_velocity,'MarkerSize',10,'Marker','.', 'MarkerSize',8,'LineWidth',2,'Color',[0 0 1]);
xlim(ax1,[5:5:50]);
hline = refline([0]);
hline.Color = 'b';
'xtick', 5:5:50;
xlim([5:5:50]);

採用された回答

YT
YT 2018 年 9 月 6 日
If you're question is on how to use xlim, ylim & yyaxis, here's an example:
%Example adapted from > https://nl.mathworks.com/help/matlab/ref/yyaxis.html
clear all;close all;
%your data
x = linspace(0,10);
y = sin(3*x);
z = sin(3*x).*exp(0.5*x);
%set xlim
xlim([-10 10]);
%set yaxis left
yyaxis left
plot(x,y);
%set ylim left
ylim([-10 10]);
%set yaxis right
yyaxis right
plot(x,z);
%set ylim right
ylim([-100 100]);

その他の回答 (2 件)

jonas
jonas 2018 年 9 月 6 日
Your syntax is a bit off
set axes limits
% two element vector with min/max
xlim([5 50]);
set axes ticks
%vector with each tick
set(gca,'xtick',0:5:50)
how do I target a specific yaxis?
% toggle the yaxis before setting properties
yyaxis left
ylim([ymin ymax])
yyaxis right
ylim([ymin ymax])

Rebecca Ellis
Rebecca Ellis 2018 年 9 月 6 日
Great thank you, much appreciated.

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by