% The University of Queensland % School of Information Technology & Electrical Engineering % ENGG7302 Advanced Computational Techniques in Engineering % Plot some p-norms in 2D % 1 norm figure; fill([1, 0, -1, 0], [0, 1, 0, -1], [0.5, 0.5, 1]); axis equal; axis off; box off; % 2 norm figure; theta = 2*pi*(0:0.01:1); fill(cos(theta), sin(theta), [0.5, 0.5, 1]); axis equal; axis off; box off; % infinity norm figure; fill([1, 1, -1, -1], [1, -1, -1, 1], [0.5, 0.5, 1]); axis equal; axis off; box off; % p norm figure; p4 = (cos(theta).^4 + sin(theta).^4).^(1/4); fill(cos(theta)./p4, sin(theta)./p4, [0.5, 0.5, 1]); axis equal; axis off; box off;