clc;
clear all;
close all;
fun=@(t,x) x.^3+x.^2-12*x;
figure, fplot(@(x) fun(0,x),[-5,5])
grid on
xlabel('x'); ylabel('f(x)');
title('Function plot')
fp=solve(fun)
[T X]=meshgrid(0:0.1:5, -5:0.1:5);
dY=fun(T,X);
dT=ones(size(dY));
L=sqrt(1+dY.^2);
figure, quiver(T,X, dT./L, dY./L,0.5);
axis tight
xlabel('Time(t)'); ylabel('x(t)')
title('Stability graph')
[t1,x1]=ode45(fun,[0 5],0.1);
figure,plot(t1,x1)
xlabel('Time (t)'); ylabel('x');
title('Solution at initial point x=0.1')