Non-linear axis plotting
22 次查看(过去 30 天)
显示 更早的评论
Background: Many years ago when plotting reciever error rate against input power I used graphpaper that was designed to give a straight line if the performance followed theory. That made it easy to spot problems (like hitting a noise floor) as plot would diverge from a straight line. Some years later it became harder to find this special paper, so I wrote a simple plotter in Java to do this.
Question: How do I do this in MATLAB? The y-axis is non-linear would ned to use the inverse complimentary error function (so y in linear space = log10(erfcInv(BER)). This question is not about how to write erfcinv(), but how about how to get the plot's y-axis to do this.
Example: - On the left: My old Java plot application, on the right a MATLAB plot using semilogy(power, BER) using the same data for reference. Not that my old BER plot grids very in size.
Here my MATLAB code that made the sample plot on the right on the picture:
function sample()
data = [
-38, 1e-3;
-37, 3.8e-4;
-36 1.2e-4;
-35 3.4e-5;
-34 7e-6;
-33 1.35e-6;
-32 1.8e-7;
-31 1.8e-8;
-30 1e-9;
];
power = data(:,1);
BER = data(:,2);
semilogy(power,BER)
grid on
end
0 个评论
回答(1 个)
Star Strider
2023-12-17
2 个评论
Star Strider
2023-12-19
My pleasure!
The axis labels are properties that can be changed, and this varies with the type of plot.
Using an example from the probplot documentation, this works —
y = 1:10;
freq = [2 4 6 7 9 8 7 7 6 5];
figure
probplot(y,[],freq)
Ax = gca;
Ax.YLabel.String = "BER";
The axis labels are axes properties. The gca call returns a handle to them, and then since the ‘YLabel’ propertiy has several specific properties of its own, setting its ‘String’ property changes the label text.
Consider requesting the sort of plot you want as an addition to the Communications Toolbox (since that appears to be what you have and are using). To do that, Contact Support and ask. Include the URL to this thread so they can refer to it.
.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!