Merging two 2D graphs (x axis divisions are different)

Hello, I needed to merge two generated data sets in one graph (they are plotted individually now) My issue is. Both share the same x-axis (100 till 250) and the Y axis on one is a completion to the other. 1st graph/data set has (the x-axis 600 divisions or you call columns, Y-axis is 1 to 600) 2nd graph/data set has (the x-axis 150 divisions or columns, Y-axis is 601 to 1200). Each one is saved in an excel sheet. How do I merge them properly? Thank you

 Akzeptierte Antwort

Star Strider
Star Strider am 23 Nov. 2017
I am not certain what you want.
See if one of these works for you:
x1 = linspace(100, 250, 600); % Create Data To Test Code
y1 = rand(size(x1)) * 600; % Create Data To Test Code
x2 = linspace(100, 250, 150); % Create Data To Test Code
y2 = 601 + rand(size(x2))*600; % Create Data To Test Code
figure(1) % Plotted Together On Same X-Range
plot(x1, y1)
hold on
plot(x2, y2)
hold off
grid
figure(2) % Plotted Consecutively
plot(x1, y1, x2+150, y2)
grid
figure(3) % Plotted Consecutively & Continuously
plot([x1 x2+150], [y1 y2])
grid

Weitere Antworten (1)

Nona M.
Nona M. am 23 Nov. 2017

0 Stimmen

Thank you so much Start Strider, your definition of the axes helps me a lot since I have the generated intensity data for the 2D graphs already.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by