Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % [b] Using the build in function for polynomial root computation we verify
- % the roots that we got in section [a]:
- r= roots([1,0,0,0,-16]);
- disp(r);
- % [c] By making a figure in the complex plan,that connects all four roots that we optain in [b] in a loop and which
- % goes from a root which has the real part equal to zero to a root that has
- % the imaginary part equal to zero or vice versa we optain a plot which shows
- % that the four roots are positioned on the vertices of a square:
- plot(([r(1),r(2),r(4),r(3),r(1)]),'-o');
- % plots the roots in the right order (for example could also be [r(2),r(4),r(3),r(1),r(2)]) to make a square and adds a small
- % circle around each root
- grid;
- % colours the background of the plot with squares with side of length of
- % one unit
- title('Argand diagram');
- % labels the diagriam
- xlabel('Real axis');
- % labels the x axis of the diagram
- ylabel('Imaginary axis');
- % labels the y axis of the diagram
- % [d] To get the length of a side of the square that we got in the plot of [c] we need
- % to calculate the modulus of the complex number that we get taking the difference of two consecutive complex
- % numbers that were used to obtain the plot.
- abs(r(1)-r(2));
- % could also be abs(r(2)-r(4))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement