A bug of function fplot (the figure is inconsistent with the one got by 'plot')

3 views (last 30 days)
syms t_d % input variable
% the expression I would like to plot↓
f(t_d)=((6848549883207071*t_d)/70368744177664 + 619810600876641/147573952589676412928)/((6848549883207071*t_d)/35184372088832 - (exp(-6000000000000*t_d)*(6000000000000*t_d - exp(6000000000000*t_d) + 1))/60000 - (4102889305024308125000000*exp(-(7843586636568035*t_d)/16384)*((7843586636568035*t_d)/16384 - exp((7843586636568035*t_d)/16384) + 1))/2460874053013946398635327350449 + 619810600876641/73786976294838206464);
t_d_lb=0; % lower bound of t_d
t_d_ub=6e-10; % upper bound of t_d
figure();% the left figure
plot(t_d_axis,f(t_d_axis));% the left figure
figure();% the right figure
fplot(f(t_d),[t_d_lb t_d_ub]); % the right figure
I often use ‘fplot’ to get the figure of an expression, but today I’ve got different curves plotted by function ‘fplot’ and ‘plot’. As the figure shown below, the left one is got by plugging in sampled inputs and drawn by ‘plot’, which is correct. However, the curve seems disappear at t_d=1.3e-10 at the right figure. I’ve checked the expression value at t_d=1.3e-10/1.6e-10/2e-10, etc, and I can make sure the left figure, which is got using ‘plot’, is correct.
Could anyone tell me if there’s a bug with ‘fplot’, and why there’s a dashed line in the right figure? What should I do to make ‘fplot’ work properly?

Accepted Answer

Walter Roberson
Walter Roberson on 24 Jul 2020
You are correct. The bug is somewhere inside
nF = feval(symengine, 'normal', f);
fplot(nF, [t_d_lb t_d_ub])
Walter Roberson
Walter Roberson on 24 Jul 2020
I did a bunch of fplot() with smaller intervals, reading off from the graphs to see what new limits I could use.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by