You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: clouds.m
    path of file: ./repos/Image-Harmonization-Dataset-iHarmony4/Lalonde and Efros/utils/3rd_party/pkovesi/Misc
    
    the code of the file until where you have to start completion: % CLOUDS
%
% Function to create a movie of noise images having 1/f amplitude spectum properties
%
% Usage: clouds(size, factor, meandev, stddev, lowvel, velfactor, nframes)
%
%        si
    
function clouds(size, factor, meandev, stddev, lowvel, velfactor, nframes)

rows = size;
cols = size;
phase = random('Uniform',0,2*pi,size,size);  % Random uniform distribution 0 - 2pi

% Create two matrices, x and y. All elements of x have a value equal to its 
% x coordinate relative to the centre, elements of y have values equal to 
% their y coordinate relative to the centre.  From these two matrices produce
% a radius matrix that gives distances from the middle

x = ones(rows,1) * (-cols/2 : (cols/2 - 1)); 
y = (-rows/2 : (rows/2 - 1))' * ones(1,cols);

x = x/(cols/2);
y = y/(rows/2);
radius = sqrt(x.^2 + y.^2);         % Matrix values contain radius from centre.
radius(rows/2+1,cols/2+1) = 1;      % .. avoid division by zero.

filter = 1./(radius.^factor);       % Construct the filter.
filter = fftshift(filter);

phasemod = fftshift(radius.^velfactor + lowvel);

% Construct fft of noise image with the specified amplitude spectrum



for n = 1:nframes
  disp(n);
  dphase = random('norm',meandev,stddev,size,size);  % Random normal distribution 
  dphase = dphase.*phasemod;

  phase = phase + dphase;
  newfft =  filter .* exp(i*phase);
  im = real(ifft2(newfft)); % Invert to obtain final noise image
  imagesc(im), axis('equal'), axis('off');

   if n==1
     CloudMovie = moviein(nframes);
   end