Generate square (n×n) matrices with random elements and n of 5, 50, 100, 150, 200, 300, 400, 500.
Measure how long it takes Matlab to calculate the inverse of each matrix by running ic; inv(A); time needed = toc;. Plot the time taken versus matrix
size. How does the calculation time change as n gets bigger? Hint: Try plotting
log time needed versus log n.
I got the symnewton down.. but how about this? am I suppose to run tic for each matrix or run tic at the end?
this is what I got so far
Code
A = rand(5);
B = rand(50);
C = rand(100);
D = rand(150);
E = rand(200);
F = rand(300);
G = rand(400);
H = rand(500);
A_inv = inv(A);
B_inv = inv(B);
C_inv = inv(C);
D_inv = inv(D);
E_inv = inv(E);
F_inv = inv(F);
G_inv = inv(G);
H_inv = inv(H);
tic
time_needed = toc;