how to create this type of plot having two signals on one axis?

 Accepted Answer

Just use plot with hold on. It looks like your X values determine how they align.
x1=1:5;
y1 = 5:-1:1;
x2=5:9;
y2 = 1:5;
plot(x1,y1,'g')
hold on
plot(x2,y2,'r')
hold off

4 Comments

i have two waveforms, i want to show them on same axes, like V1 and V2 signal, they have same time, how can i devide the time so that V1 appear first from 0 to 1 sec , and V2 appear second from 1 sec to 2 sec,like shown here
Adjust the time vector of the 2nd signal by adding the end time of the first signal to it.
x1 = 0:4;
y1 = 5:-1:1;
x2 = 0:4;
y2 = 1:5;
plot(x1,y1,'g')
hold on
plot(x2+x1(end),y2,'r')
hold off
for workspace , should i import signal data as array or dataset?
"The dataset data type is not recommended. To work with heterogeneous data, use the MATLAB® table data type instead. See MATLAB table documentation for more information."
I would add that, if your data is all the same data type, then use an array (readmatrix instead of readtable)

Sign in to comment.

More Answers (0)

Categories

Products

Community Treasure Hunt

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

Start Hunting!