Matlab warning when using log

4 次查看(过去 30 天)
I have quiete a long script basically just consiting of comments for plotting pairs of points and customizing the resulting plot. However anytime I want to change axis to logscale I receive the following waring:
Warning: Error occurred while executing the listener callback for event
WindowMouseMotion defined for class matlab.ui.Figure:
Error using matlab.graphics.axis.dataspace.CartesianDataSpace/TransformPoints
DataSpace or ColorSpace transform method failed.
Error in matlab.graphics.internal.transformDataToWorld (line 29)
vertexData = double(hDataSpace.TransformPoints(belowMatrix,iter));
Error in matlab.graphics.chart.internal.convertDataSpaceCoordsToViewerCoords (line
44)
vertexData = matlab.graphics.internal.transformDataToWorld(hDataSpace, belowMatrix,
dataspaceData);
Error in matlab.graphics.function.FunctionLine/calcXYZData
Error in matlab.graphics.function.FunctionLine/getXYZData
Error in matlab.graphics.function.FunctionLine/doGetNearestPoint
Error in matlab.graphics.interaction.uiaxes.DataTipsBase
Error in matlab.graphics.interaction.actions.Linger/motionCallback
Error in matlab.graphics.interaction.actions.Linger
This is the code I used. Plain plotting
f = [5 10 20 40 80 160 320 640]*10^3;
U = [4.77 4.23 3.11 1.85 0.98 0.50 0.25 0.13]./5;
plot(f,U,'x','MarkerSize',14,'LineWidth',2.5)
hold on
grid minor
xlabel('Frequenz f in Hz','FontSize',16,'Interpreter','latex')
ylabel('Quotient $\frac{U_E}{U_A}$','FontSize',16,'Interpreter','latex')
axis([0 7*10^5 0 4.77./5])
set(gca,'FontSize',14)
syms x;
R = 10^3; C = 10*10^(-9);
fG = 1.588e+04;
F = 1./sqrt((x/fG).^2+1);
fplot(F,'LineWidth',1)
set(gca,'YScale','log','XScale','log') %this is the reason for all of it.
legend('Messwerte','Verlauf')
I tried using loglog or any other function to manipulate axis, but it occures steadily.
  4 个评论
Niklas Kurz
Niklas Kurz 2021-9-16
编辑:Niklas Kurz 2021-9-16
Hang on, if you comment %set(gca,'FontSize',14) (only that) - do you get a warning then?
Respectively this is not needed. Just by trying to zoom out the warning should pop up, right?
Adam Danz
Adam Danz 2021-9-16
Sorry, I meant Matlab R2021a. It didn't cause an error in 21a. However, I didn't catch that the error is caused when zooming. When I zoom in 21a, I do get the warning you shared. Looks like WR set it straight.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2021-9-16
axis([0 7*10^5 0 4.77./5])
set(gca,'YScale','log','XScale','log') %this is the reason for all of it.
Do not use an axis limit of 0 with log scale: it would require an infinite plot.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by