Problem with plot array of signals(by row) and x axis
조회 수: 5 (최근 30일)
이전 댓글 표시
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
Image Analyst
2016년 5월 22일
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?
답변 (1개)
dpb
2016년 5월 22일
편집: dpb
2016년 5월 22일
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"
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Measurements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!