Matlab warning when using log

7 vues (au cours des 30 derniers jours)
Niklas Kurz
Niklas Kurz le 15 Sep 2021
Commenté : Adam Danz le 16 Sep 2021
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 commentaires
Niklas Kurz
Niklas Kurz le 16 Sep 2021
Modifié(e) : Niklas Kurz le 16 Sep 2021
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 le 16 Sep 2021
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.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 16 Sep 2021
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.
  1 commentaire
Niklas Kurz
Niklas Kurz le 16 Sep 2021
Modifié(e) : Niklas Kurz le 16 Sep 2021
that's it, actually pretty obvious:

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by