How to plot each row of a MxN array as one value

1 visualización (últimos 30 días)
Cristine  Sev
Cristine Sev el 4 de Jun. de 2022
Editada: dpb el 6 de Jun. de 2022
Hello guys, so here is the thing,i have an array lets say Z (Mx3). Its row is the encoded binary form of a sampled and quantized signal...what i want to do is plot Z and in Y-axis i want to display the binary code from each row...lets say z = [0 0 1;0 1 0;1 0 1;1 0 1;1 1 1;0 0 0]...so i want to plot it and Y-axis should start from 0 0 0 then next level should be 0 0 1 till 1 1 1...in the photo is an example of what i want

Respuesta aceptada

dpb
dpb el 4 de Jun. de 2022
Editada: dpb el 6 de Jun. de 2022
Looks like
hL=stairs(z*2.^(2:-1:0).');
yticks([0:2:6])
yticklabels(dec2bin(yticks,3))
otta' do it...
That plots against ordinal position on x axis; looks like the original was plotted against
N=size(z,1);
hL=stairs([1:N]/N,z*2.^(2:-1:0).');
to get the range from 0-1

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by