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

3 visualizaciones (últimos 30 días)
Lewis
Lewis el 19 de Mzo. de 2022
Respondida: Sulaymon Eshkabilov el 20 de Mzo. de 2022
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 comentarios
Lewis
Lewis el 19 de Mzo. de 2022
Oh it seems to be working now, I made a small error. Thanks

Iniciar sesión para comentar.

Respuestas (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 20 de Mzo. de 2022
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

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by