How to compare 2 Boolean Stairs graph

3 visualizaciones (últimos 30 días)
Victor Marjot
Victor Marjot el 18 de Mzo. de 2021
Comentada: Victor Marjot el 13 de Abr. de 2021
I'm working on functions returning boolean values.
Using a script I would like to compare to stairs graph :
Here is how I create the stairs graphs, with t1 and t2 the time, stored in vectors. v1 and v2 the values at the given times, also in vector format :
f1 = stairs(t1,v1)
f2 = stairs(t2,v2)
My goal is to plot a new stair graph where the value is equal to :
  • 1 when both stairs graph are equal at the same time,
  • 0 when the graph are different.
Any idea?
Thank you in advance.

Respuestas (1)

ANKUR KUMAR
ANKUR KUMAR el 19 de Mzo. de 2021
clc
clear
A = randi([0 1], 1,10);
B = randi([0 1], 1,10);
data={A,B,A==B};
for kk=1:3
subplot(3,1,kk)
stairs(data{kk},'r-o')
end
  1 comentario
Victor Marjot
Victor Marjot el 13 de Abr. de 2021
It doesn't answer the problem. You are comparing two vectors while the problem is comparing two graphs.

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by