MATLAB: Random surface not smoothing :(

colourfulgeneratepicturepointy but not supposed to besurface

Hello!
I have recently made a script which generates a random surface, but I need it to be smooth like the picture shown and was wondering what I have done wrong. I've added it all below. Thankyou!
Regards, Steve

Best Answer

To make it smooth, you need more points. The easiest way is to define them in your code from the outset, although you can interpolate them as well (with the interp2 function).
I would write it as:
N = 25;
z0 = rand(N);
x0 = linspace(1, 5, N);
y0 = linspace(1, 5, N);
Related Question