フィルターのクリア

Problem with piecewise Plots

1 回表示 (過去 30 日間)
Kareem Elgindy
Kareem Elgindy 2023 年 2 月 23 日
コメント済み: Askic V 2023 年 2 月 23 日
The following commands do not show the last point of the graph of the function. Can someone explain why?
syms f(t)
f(t) = piecewise(0<=t<2*pi,2,t==2*pi,0);
fplot(f,[0 2*pi],'r*--')
xlim([0 7])
ylim([-1 5])
  1 件のコメント
Askic V
Askic V 2023 年 2 月 23 日
編集済み: Askic V 2023 年 2 月 23 日
syms f(t)
tol = 1e-3;
f(t) = piecewise((t>=0) & (t<2*pi),2,(t>=2*pi) & (t<2*pi+tol),0);
fplot(f,[0 2*pi+tol],'r*--')
xlim([0 7])
ylim([-1 5])
This is what I would do.

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

回答 (1 件)

Torsten
Torsten 2023 年 2 月 23 日
編集済み: Torsten 2023 年 2 月 23 日
:-)
syms f(t)
f(t) = piecewise(0<=t<2*pi,2,2*pi<=t<=2*pi+0.001,0);
fplot(f,[0 2*pi+0.001],'r*--')
xlim([0 7])
ylim([-1 5])
  1 件のコメント
Askic V
Askic V 2023 年 2 月 23 日
:) almost exactly the same. I replaced 0<=t<2*pi this part as Matlab suggested itself.

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

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by