%Example M-File for working with Phasors
clc
disp('Demonstration of different phasor commands')
disp('Demonstrate different constructor types')
a=phasor(2,3)
b=phasor([3 4])
c=phasor([5:7],[8:10])
z=[1 2;3 4;5 6];
d=phasor(z)
disp('Press any key to continue')
pause
disp('demonstrate subsref and subsasgn calls')
disp('a.mag')
a.mag
disp('b.angle')
b.angle
disp('c(3).mag')
c(3).mag
disp('d(2).angle')
d(2).angle
disp('Press any key to continue')
pause
disp('a.mag=5')
a.mag=5
disp('b.angle=16')
b.angle=16
disp('c(3).mag=22')
c(3).mag=22
disp('d(2).angle=0')
d(2).angle=0
disp('Now we are going to insert phasor b into c(1)')
disp('c(1)=b')
c(1)=b
disp('Press any key to continue')
pause
disp('demonstrate abs, get, set, mag, and angle')
disp('abs(c)')
abs(c)
disp('abs(c,1)')
abs(c,1)
disp('get(c,''mag'')')
get(c,'mag')
disp('get(d,''angle'',1)')
get(d,'angle',1)
disp('set(c,''mag'',3)')
set(c,'mag',3)
disp('set(c,''angle'',9,1)')
set(c,'angle',9,1)
disp('mag(c,1000)')
mag(c,1000)
disp('mag(c,0,2)')
mag(c,0,2)
disp('angle(d,50)')
angle(d,50)
disp('angle(d,0,3)')
angle(d,0,3)
disp('Press any key to continue')
pause
disp('demonstarte add, and minus')
disp('e=a+b')
e=a+b
disp('f=c+d')
f=c+d
disp('Press any key to continue')
pause
disp('demonstrate mtimes/times, mldivide/ldivide, mrdivide/rdivide')
disp('I have made mtimes the same as times, mldived the same as ldivide')
disp('and mrdivide the same as rdivide for now')
disp('3*a')
3*a
disp('b*5')
b*5
disp('a/3')
a/3
disp('a./3')
a./3
disp('3.\a')
3.\a
disp('3\a')
3\a
disp('c*3')
c*3
disp('2*c')
2*c
disp('c/2')
c/2
disp('c./2')
c./2
disp('2\c')
2\c
disp('2.\c')
2.\c