plot with two y axis matlab - same axis at 0

5 ビュー (過去 30 日間)
Tobias Dehn Nielsen
Tobias Dehn Nielsen 2022 年 11 月 15 日
コメント済み: VBBV 2022 年 11 月 15 日
Hey
I want to plot two functions in the same plot. The output vs the input of a loop.
As you can see on the picture the picture dosnt look very pretty.
Is there a way to ensure that the "0" axis is the same for both functions
%Plot output vs input of plant
yyaxis left
plot(Time,LimitedVoltage,'LineWidth',3.0)
ylabel("Voltage [V]","FontSize",30,"FontName","Times")
yyaxis right
plot(Time,PositionOfShaft,'LineWidth',3.0)
ylabel("Amplitude [\circ]","FontSize",30,"FontName","Times")
legend({"Input to plant","Output of inner loop"},"FontSize",15,"FontName","Times","location","northwest")
xlabel("Time [s]","FontSize",30,"FontName","Times")
grid

回答 (1 件)

VBBV
VBBV 2022 年 11 月 15 日
yyaxis left
plot(Time,LimitedVoltage,'LineWidth',3.0)
ylabel("Voltage [V]","FontSize",30,"FontName","Times")
ylim([0 10]) % give the y-axis limit
yyaxis right
  1 件のコメント
VBBV
VBBV 2022 年 11 月 15 日
Set the y-axis limit using ylim

サインインしてコメントする。

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by