Code covered by the BSD License  

Highlights from
Phasor/Polar Data Type

from Phasor/Polar Data Type by Timothy Felty
Implementation of Phasor/Polar data type and associated functions

y=onesphas(x,varargin)
function y=onesphas(x,varargin)
% create a ones phasor matrix full of 0/_0 
% y=onesphas(x,varargin)
% y=onesphas(3) => 3x3 ones phasor matrix
% y=onesphas(3,4) => creates 3x4 ones phasor matrix
% y=onessphas([3 4]) creates a 3x4 ones phasor matrix
if nargin == 1
    if numel(x)==1 % simple nxn matrix 
        y=phasor(ones(x),zeros(x));
    elseif numel(x)==2 % an nxm matrix  
        y=phasor(ones(x(1),x(2)),zeros(x(1),x(2)));
    else
        error('X can only be 1 or 2 elements in length and scalar')
    end
elseif nargin==2
    if numel(x)==1 & numel(varargin{1})==1
        y=phasor(ones(x,varargin{1}),zeros(x,varargin{1}));
    else
        error('Incorrect calling usage')
    end
else
    error('Usage: y=onesphas(sizeofarray);')
end

Contact us at files@mathworks.com