Non-linear axis plotting

22 次查看(过去 30 天)
Steven
Steven 2023-12-17
评论: Star Strider 2023-12-19
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.
Example plots
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

回答(1 个)

Star Strider
Star Strider 2023-12-17
Probably the closest you could get to that is the Statistics and Machine Learning Toolbox probplot function.
I do not have the Communications Toolbox (I do not need it for what I do), however it has functions such as berfit and related functions that could be appropriate.
  2 个评论
Steven
Steven 2023-12-19
@Star Strider Thank you. The probplot did look promising, but having played with it for a while now I can't find a way to get I need from the y-axis. My need is all about presentaion of the data ratherthan analysis.
berfit might be an alternative way to present this data, but I don't feel its as intuitive as having an a straight line - possible because that's what I'm used to.
This got the closest, I think, using probplot('half normal', power, [], count), where count = BER * 1e9, but the -y-axis needs to be BER not propability.
Star Strider
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.
.

请先登录,再进行评论。

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by