필터 지우기
필터 지우기

Plot symbolic function and non symbolic functions on the same plot?

조회 수: 1 (최근 30일)
Lewis
Lewis 2022년 3월 19일
답변: Sulaymon Eshkabilov 2022년 3월 20일
Hi, I am trying to plot a symbolic function ( fplot(@(x) x) ) and on the same figure, plot lines between specific pairs of points on the graph. (i.e. A = (x1,y1); B = (x2,y2); plot(A,B) )
The trouble is that fplot is used for symbolic functions and plot is used for nomal points, so they don't go onto the same graph. Is there any way of solving this?
Thanks
  댓글 수: 2
Torsten
Torsten 2022년 3월 19일
fplot(...)
hold on
plot(...)
does not work ?
Lewis
Lewis 2022년 3월 19일
Oh it seems to be working now, I made a small error. Thanks

댓글을 달려면 로그인하십시오.

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2022년 3월 20일
Here is a simple example:
figure
fplot(@(x) sin(x), [-pi, pi])
hold on
x = linspace(-pi, pi, 25);
plot(x, sin(x), 'rd')
legend('fplot', 'plot', 'location', 'best')
grid on

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by