Matlab warning when using log

4 visualizzazioni (ultimi 30 giorni)
Niklas Kurz
Niklas Kurz il 15 Set 2021
Commentato: Adam Danz il 16 Set 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 Commenti
Niklas Kurz
Niklas Kurz il 16 Set 2021
Modificato: Niklas Kurz il 16 Set 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 il 16 Set 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.

Accedi per commentare.

Risposta accettata

Walter Roberson
Walter Roberson il 16 Set 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 Commento
Niklas Kurz
Niklas Kurz il 16 Set 2021
Modificato: Niklas Kurz il 16 Set 2021
that's it, actually pretty obvious:

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by