Code covered by the BSD License  

Highlights from
Image 2D Transformations

from Image 2D Transformations by Madhu S. Nair
Image 2D Transformations Translation Rotation Scaling

scaling(x)
%Question No:8
%IMAGE SCALING

function scaling(x)
f=imread(x);
[r,c]=size(f);
sx=input('Enter the scaling parameter, sx = ');
sy=input('Enter the scaling parameter, sy = ');
p=1;
for i=1:r
    l=i*sx;
    q=1;
    for j=1:c
        m=j*sy;
        for a=p:round(l)
            for b=q:round(m)
                g(a,b)=f(i,j);
            end
        end
        q=round(m)+1;
    end
   p=round(l)+1;
end
imshow(f), figure, imshow(g);

Contact us at files@mathworks.com