# How can I plot multiple signals in a single plot? Please give me suggestions which functions have used for this.

13 vues (au cours des 30 derniers jours)
Komal le 23 Nov 2023
Commenté : Komal le 28 Nov 2023
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponse acceptée

Chunru le 23 Nov 2023
Modifié(e) : Chunru le 23 Nov 2023
% Generate som data
fs = 1000;
t=(0:1/fs:1)';
f = 10:10:40;
x = sin(2*pi*t*f);
x = x + 0.1*randn(size(x));
n = size(x, 2); % num of channels
yyaxis left
s = 0.4; % scale factor
plot(t, s*x + (0:n-1) );
yticks(-1:n)
yticklabels(["" "abc" "def" "a" "b" ""])
yyaxis right
ylim( [-1 n]/s)
yticks( [0 1]/s)
##### 5 commentairesAfficher 3 commentaires plus anciensMasquer 3 commentaires plus anciens
Komal le 26 Nov 2023
Dear experts, how can I plot in this type? Which function is used for this plotting?
Dyuman Joshi le 26 Nov 2023
@Walter Roberson has already mentioned a function below. Did you try that?

Connectez-vous pour commenter.

### Plus de réponses (1)

Walter Roberson le 24 Nov 2023
##### 4 commentairesAfficher 2 commentaires plus anciensMasquer 2 commentaires plus anciens
Walter Roberson le 27 Nov 2023
Modifié(e) : Walter Roberson le 27 Nov 2023
Create a timetable() object with variable names {'Input Signal', 'Clean Signal', 'Artifact'} and with 'RowTimes' set to the time vector.
Now stackedplot() that timetable object.
For example,
TT = timetable(input_signal(:), clean_signal(:), artifact(:), 'VariableNames', {'Input Signal', 'Clean Signal', 'Artifact'}, 'RowTimes', t);
stackedplot(TT);
Komal le 28 Nov 2023
Thank you so much sir.

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Annotations dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by