Creating plot with double x axis

7 views (last 30 days)
jack london
jack london on 13 Dec 2021
Commented: jack london on 14 Dec 2021
Hi everyone,
I want to plot graph with two x axis. One is at the base level other one is at the uppermost level.
I plot u1 wrt y-axis also I want add u2 wrt to y-axis.
I write code below . How I add u2 datas as an second x-axis on the upper level ? Thanks for answer.
Simialr to this example
clear
clc
y = [2 3 4 5 6 7 8 9 10 15 20 25 30 40 50 60 80 100 150 200 280]
u1 =[6.76 7.11 7.48 7.79 8.03 8.30 8.49 8.72 8.91 9.70 10.16 10.44 10.53 10.71 10.76 10.81 10.90 11.0 11.07 11.1 11.02]
u2 =[19.0 18.1 17.0 16.2 15.8 15.4 15.1 14.4 14.1 12.8 13.2 12.5 11.8 11.1 10.5 10.5 9.3 9.2 8.5 7.9 7.3]
plot(u1,y,'p-','LineWidth',1,'Marker','square','LineStyle','none'); xlabel('u1 (m/s)'); ylabel('y (mm)');

Accepted Answer

David Hill
David Hill on 13 Dec 2021
Why not just use subplot?
subplot(2,1,1)
plot(u1,y)
subplot(2,1,2)
plot(u2,y)
  5 Comments

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!