N = 500;

Times1 = [];
Times2 = [];

for n=1:N;
    A = rand(n,n);
    b = rand(n,1);
    tic; inv(A)*b; time1=toc;
    tic; A\b; time2=toc;
    Times1 = [Times1, time1];
    Times2 = [Times2, time2];
end

n = 1:N;
plot(n, Times1, 'r*', n, Times2, 'b*')