MATLAB: To change the scale of a plotted graph

berchange the scale of a auto generated graph

Hi fellow friends,
I want to change the scale of a graph to a new scale. previous scale is start from 0 with the increment of 0.5. this graph and scale is auto generated from the data. my coding for plotting as below.
bit_error(1,oye) = sum(m5~=data_topi); % BER
Eb_No=snr(oye)-3; EbNo=10^(Eb_No/10);
% fprintf('Looping = %1d, SNR = %1d, BitError = %1d,...
% jum,snr(oye),bit_error(oye));
% if snr(oye) == max(snr)
% display('*****************************');
% end
end
total_bit_error(jum,:) = bit_error;
end
BER = sum(total_bit_error)/(length(m5)*iteration);
figure; % BER vs SNR in linear value
plot(snr,BER,'ro-'); hold on
grid on
xlabel('\fontname{calibri}{SNR}')
ylabel('\fontname{calibri}{BER}')
title('\fontsize{10}{BER vs SNR in Linear Value}')

Best Answer

yticks = [0 : 0.01 : 0.25];
set(gca,'YTick', yticks, 'YTickLabel', cellstr(num2str(yticks(:))) );
However, if the current automatic scaling has its first tick at 0.5 then I predict that the result of the above would be to crowd a lot of ticks in to a small portion of the graph.
If the first tick is at 0.5 then your BER must have values that are at least 0.8 (and probably higher.) Do you want the ticks to just stop at 0.25 leaving the rest unlabelled but visible? Do you want the part of the graph above 0.25 to be cut off and only up to 0.25 shown? Do you want the full range of BER values to be plotted, but for the tick labels to "lie" above the values by labeling (e.g.) 1.72 as if it were 0.21 ?