Problem with using 'DisplayName' property in fplot()

7 visualizaciones (últimos 30 días)
Lennart Reich
Lennart Reich el 23 de Jul. de 2020
Comentada: Lennart Reich el 23 de Jul. de 2020
Hello everbody,
I wrote a function to plot a limit value in a existing figure. You can see it below. This function works well without using 'DisplayName' in fplot().
If I want to use 'DisplayName' I have got the following error:
Error using plot
Error in color/linetype argument.
Error in fplot (line 154)
plot(xx,y,marker,'parent',cax)
Error in limits (line 48)
fplot(f, axes.XLim, 'DisplayName', 'Test')
Can someone help me to fix this problem.
Thank you in advance,
Lennart
function limits(fig, standard)
%% Code
axes = fig.CurrentAxes;
axes.NextPlot = 'add';
if strcmp(standard, 'ECE R10 10m QuasiPeak')
f1 = @(x) 32;
f2 = @(x) 32 + 15.13 .* log10(x/75000000);
f3 = @(x) 43;
elseif strcmp(standard, 'ECE R10 10m Average')
f1 = @(x) 22;
f2 = @(x) 22 + 15.13 .* log10(x/75000000);
f3 = @(x) 33;
elseif strcmp(standard, 'ECE R10 3m QuasiPeak')
f1 = @(x) 42;
f2 = @(x) 42 + 15.13 .* log10(x/75000000) ;
f3 = @(x) 53;
elseif strcmp(standard, 'ECE R10 3m Average')
f1 = @(x) 32;
f2 = @(x) 32 + 15.13 .* log10(x/75000000) ;
f3 = @(x) 43;
elseif strcmp(standard, 'ECE R10 EUB QuasiPeak')
f1 = @(x) 62 - 25.13 .* log10(x/3000000);
f2 = @(x) 52 + 15.13 .* log10(x/75000000) ;
f3 = @(x) 63;
elseif strcmp(standard, 'ECE R10 EUB Average')
f1 = @(x) 52 - 25.13 .* log10(x/3000000);
f2 = @(x) 42 + 15.13 .* log10(x/75000000) ;
f3 = @(x) 53;
else
error('Dies ist kein vorhandener Grenzwert!')
end
f = @(x) f1(x).*((30000000 <= x) & (x <= 75000000)) + f2(x).*((75000000 < x) & (x < 400000000)) + f3(x).*((400000000 <= x) & (x < 1000000000));
fplot(f, axes.XLim, 'DisplayName', 'Test')
end
  2 comentarios
Robert U
Robert U el 23 de Jul. de 2020
Problem seems not to be "DisplayName" property but the limits given by axes.XLim.
Kind regards,
Robert
Lennart Reich
Lennart Reich el 23 de Jul. de 2020
But without axes.XLim I have got the same error.

Iniciar sesión para comentar.

Respuestas (1)

madhan ravi
madhan ravi el 23 de Jul. de 2020
Editada: madhan ravi el 23 de Jul. de 2020
F = fplot(f);
set(F, 'DisplayName', 'Test')
  8 comentarios
madhan ravi
madhan ravi el 23 de Jul. de 2020
Thank you sir Walter!
Lennart Reich
Lennart Reich el 23 de Jul. de 2020
Yeah this works fine. Thank you Walter.

Iniciar sesión para comentar.

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Productos


Versión

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by