fplot tolerance parameter error

x = inline (' (1/e) * ((t>0) & (t<=e))', 't', 'e' );
e = 1/100;
t1 = -1;
t2 = 5;
t = [t1, t2];
fplot (x, t, 1e-5, 1000, '-', e)
Warning: The tolerance parameter input to fplot has been removed.
Error using fplot
Invalid parameter '1000'.
set (gca, 'FontSize',16)
xlabel('t')
ylabel('p_\epsilon(t)')
axis ([t -0.1 1.1/e])
title('Pulse function,\epsilon = 1/100')

 採用された回答

Star Strider
Star Strider 2023 年 3 月 10 日

1 投票

Please begin to use anonymous functions rather than inline funcitons —
x = @(t,e) (1/e) .* ((t>0) & (t<=e));
e = 1/100;
t1 = -1;
t2 = 5;
t = [t1, t2];
fplot (@(t)x(t,e), t, 'MeshDensity',500)
set (gca, 'FontSize',16)
xlabel('t')
ylabel('p_\epsilon(t)')
axis ([t -0.1 1.1/e])
title('Pulse function,\epsilon = 1/100')
It is necessary to increase the 'MeshDensity' in order to show the pulse. The values of ‘t’ will otherwise ‘skip over’ the interval of interest.
.

2 件のコメント

John
John 2023 年 3 月 10 日
Thank you!
Star Strider
Star Strider 2023 年 3 月 10 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

製品

リリース

R2022b

タグ

質問済み:

2023 年 3 月 10 日

コメント済み:

2023 年 3 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by