Unable to set the scale fro -inf to inf
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I am trying to plot 2 arrays but I am not getting the expected result. I am sure I am making some mistake but I am unable to identify it.
x = [1 0.93 1 0.96 1 1 1 0.86];
snr = [Inf 9 -0.539 -4.98 -7.9 -10.08 -11.83 -13.28];
plot(snr,x)
ylim([0 1])
xlim([-inf inf])
Firstly, the plot is missing the value at 'inf' which is 1 and second, I am trying to make the scale of x axis from -inf to inf but that is not working.
I am actually trying to make the x axis ticks as [ -inf -15 -10 -5 0 5 10 15 int] but i am still trying to figure out how to do that.
Can someone help me with this. Any help is appreciated.
Thank you
0 件のコメント
回答 (1 件)
Sulaymon Eshkabilov
2023 年 1 月 13 日
Note that [inf -inf] will make your plot hardly visible and thus, you had better take a bit larger values to the two extreme points, e.g.:
x = [1 0.93 1 0.96 1 1 1 0.86];
snr = [Inf 9 -0.539 -4.98 -7.9 -10.08 -11.83 -13.28];
plot(snr,x, 'ro-', 'linewidth', 2), grid on
ylim([0 1])
xlim([-25 25])
xticks([-25 -15 -10 -5 0 5 10 15 25])
xticklabels({'-inf', '-15', '-10', '-5', '0', '5', '10', '15', 'inf'})
2 件のコメント
Sulaymon Eshkabilov
2023 年 1 月 13 日
Here is how you can make it visible:
x = [1 0.93 1 0.96 1 1 1 0.86];
snr = [-25 9 -0.539 -4.98 -7.9 -10.08 -11.83 -13.28];
[SNR, IND] = sort(snr);
X = x(IND);
plot(SNR,X, 'ro-', 'linewidth', 2), grid on
ylim([0 1])
xlim([-25 25])
xticks([-25 -15 -10 -5 0 5 10 15 25])
xticklabels({'-inf', '-15', '-10', '-5', '0', '5', '10', '15', 'inf'})
参考
カテゴリ
Help Center および File Exchange で Graphics Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!