필터 지우기
필터 지우기

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 CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by