1. Math
  2. Advanced Math
  3. in this exercise use the function plotcmplxm provided below to...

Question: in this exercise use the function plotcmplxm provided below to...

Question details

In this exercise use the function “plotcmplx.m” (provided below) to plot complex numbers as vectors (phasors) in the following questions.

(a) For the following complex numbers, calculate magnitude and phase, write down the number as a complex exponential and plot the number:

a1: z1 = 0.75

plotcmplx.m

function plotcmplx(z,c)

% Usage:

% plotarrow(z,c);

%

% - z is a complex number

% - c = 'b' for blue color, 'r' for red color, etc

%

% Adapted from "phasor.m" script from Copyright (c) 2009, Erik Cheever

% Copyright (c) 2010, Andres Kwasinski

newplot

A=abs(z);

phi=angle(z);

hold on

%Define Arrow.

x=[0 A A-0.1*A A A-0.1*A]';

y=[0 0 0.1*A 0 -0.1*A]';

%Rotate Arrow.

x1=x*cos(phi)-y*sin(phi);

y1=x*sin(phi)+y*cos(phi);

%Plot Arrow.

plot(x1,y1,c,'LineWidth',2)

%Draw dotted circle to show magnitude of error.

theta=0:0.1:2*pi;

plot(A*cos(theta),A*sin(theta),strvcat(c,':'));

grid

hold off

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution