Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help writing a matlab function that does the following: Create a function

ID: 2248072 • Letter: I

Question

I need help writing a matlab function that does the following:

Create a function called DisplayPhasor that displays a given complex value in both rectangular and polar form. The polar form should display the angle in degrees rather than radians. The function should accept a single complex number as an argument, along with an optional text string that can be used as a label. A usage example is: >> z = 5 + j*12; DisplayPhasor (Z) Z = 5+121 = 13 > DisplayPhasor (2, 'ZLoad') ZLoad = 3+41 = 5

Explanation / Answer

matlab programme for function:

function[rho,theta]=displayphasor(z)
a=real(z);
b=imag(z);
rho=sqrt(a^2+b^2);
theta=atand(b/a)
end

function calling:

clc;
clear all;
close all;
z=input('enter the complex number');
[rho,theta]=displayphasor(z)

output:

enter the complex number1+i

theta =

45


rho =

1.4142


theta =

45