I used the dirfield.m so I had better visualization
f=@(x,y)x
figure;
dirfield(f,-2:0.2:2,-2:0.2:2)
xlabel('$x$','interpreter','latex','fontsize',17);
ylabel('$y$','interpreter','latex','fontsize',17);
title('Slope Field for $\displaystyle\frac{dy}{dx}=x$',...
'interpreter','latex','fontsize',17);
hold on
[x,y] = ode45(f,[-2,2],3);
plot(x,y)
hold off