Borrar filtros
Borrar filtros

Problem with plot array of signals(by row) and x axis

4 visualizaciones (últimos 30 días)
billy papas
billy papas el 22 de Mayo de 2016
Editada: dpb el 22 de Mayo de 2016
I got a 2d array ,that each row represents a signal (for wiener filtering)
Arr(10,45).
I want to plot,all signals (all column) in same figure, with X axis the K coefficient of wiener fieltering that is
K=(-11:0.5:11);
Which is of size=45.I also want it to be with logarithmic in both axis , x and y.
But when i plot with[![enter image description here][1]][1]
loglog(Arr.');
set(gca,'xtick',(-11:0.5:11);
The result is not what i need.
What's going on?thanks in advance.
  1 comentario
Image Analyst
Image Analyst el 22 de Mayo de 2016
I'm not sure what you need. If the horizontal axis is supposed to be K, then what value(s) would you have for the "y" axis at each K?

Iniciar sesión para comentar.

Respuestas (1)

dpb
dpb el 22 de Mayo de 2016
Editada: dpb el 22 de Mayo de 2016
Problem is trying to put negative linearly-spaced values on a log axis; they don't fit all that well...
The x-axis is the ordinal value of [1:length(k)] or 1:45 but you've placed tick marks starting at -11 so that until you use up the values in the array corresponding to the number of elements that are in the negative range, they're out of the axis limits and so don't show.
It's kinda tough to get a set that will work really well, but you can start and it will illustrate what the issue is from
loglog(abs(randn([size(k,2),4])))
xlim([1,length(k)])
set(gca,'xtick',[1:2:length(k)])
set(gca,'xticklabel',k([1:2:end]))
This gives corresponding tick labels at integral values of k which correspond to the locations along the x-axis of the position in the array. As you'll note, there's insufficient room for them once you get above k=0 so you'll want to change the spacing to every 4th or even higher after the first 10 or so; you'll have to 'spearmint to see what works out best for you...
For comparison, try
set(gca,'xtick',[1:2:23 25:4:45])
set(gca,'xticklabel',k([1:2:23 25:4:end]))
Legible, but still far from ideal...."salt to suit"

Community Treasure Hunt

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

Start Hunting!

Translated by