matlab两个图共用一个x轴_如何在Matlab图形中插入两个X轴

I would like create a Matlab figure with a double X axis (m/s and km/h) with the same plot.

I have found plotyy and - in Matlab reposity - plotyyy, but I am looking for:

A double X axis.

Together below the plot.

My code is very simple:

stem(M(:, 1) .* 3.6, M(:, 3));

grid on

xlabel('Speed (km/h)');

ylabel('Samples');

M(:, 1) is the speed (in m/s), and M(:, 3) is the data.

I would like only a second line, in the bottom, with the speeds in m/s.

解决方案

You can do something like the following. In comparison to the solution of @Benoit_11 I do use the normal Matlab labels and refer to both axes with handles so the assignments are explicit.

The following code creates an empty x-axis b with the units m/s with a negligible height. After t

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值