Docsity

Complex Numbers - Lab 3 - Signal Analysis | ECE 201, Lab Reports of Electrical and Electronics Engineering

Toggle sidebar
bg1
ECE201 Lab#3: Complex Numbers
Put the instructions in a script file (with .m extension) for this lab.
Instructions:
1. Have the user enter in the numerical value of one (1) to select ’Option One’ or a two (2)
to select ’Option 2’. ’Option 1’ is to acknowledge that the data entered will be in polar form.
’Option 2’ is to acknowledge that the data entered will be in rectangular form. Return an error
if anything else is entered here (besides a one or a two) and re-enter the value if this occurs.
2. If the user selects the polar form option:
•have the user select an option to determine if the phase to be entered is in degrees or radians
and return an error if some other selection is entered. Again, use a one (1) to represent
the first option and a two (2) to represent the second. Return an error if anything else is
entered here besides a one or a two. Re-enter the value if this occurs.
Reminder: 1 radian = 180/π degrees.
•have the user enter in the complex number with the magnitude and phase.
•convert this complex number to its equivalent in rectangular form x+jy and call it CP1.
•plot this complex number on a real vs. imaginary plot. Use a red asterick to mark the
point. (Consider the real data to be on the x-axis and the imaginary data to be on the
y-axis). Include a title “The rectangular form of CP1 is x+jy” and replace xand ywith
the appropriate data.
•prompt the user to enter in the real and imaginary parts of another complex number. Call
it CP2.
•return an error if CP1 = CP2 and re-enter CP2 if this occurs.
•prove/show that rCP1∗C P 2=rCP 1∗rC P 2and prove/show that θCP1∗C P 2=θCP 1+θC P 2.
3. If the user selects the rectangular form option:
•have the user enter in the complex number with the real part first and the imaginary part
second.
•convert this complex number to its equivalent in polar form rejθ and call it CP1.
•plot CP1 on a polar plot. Mark it with a red asterick.
•Add a title “The polar form of CP1 is rej θ”. Replace rand θwith the appropriate data.
•prompt the user to enter in the magnitude and phase (in radians) of CP2. Return an error
if CP1 = CP2 and re-enter CP2 if this occurs.
•prove/show that rCP1/C P 2=rCP 1/rC P 2and prove/show that θCP1/C P 2=θCP 1−θC P 2.
Remember:
•Complex numbers written as x=a+jb are considered to be in the rectangular form.
1
pf2

Partial preview of the text

Download Complex Numbers - Lab 3 - Signal Analysis | ECE 201 and more Lab Reports Electrical and Electronics Engineering in PDF only on Docsity!

ECE201 Lab#3: Complex Numbers

Put the instructions in a script file (with .m extension) for this lab.

Instructions:

  1. Have the user enter in the numerical value of one (1) to select ’Option One’ or a two (2) to select ’Option 2’. ’Option 1’ is to acknowledge that the data entered will be in polar form. ’Option 2’ is to acknowledge that the data entered will be in rectangular form. Return an error if anything else is entered here (besides a one or a two) and re-enter the value if this occurs.
  2. If the user selects the polar form option:
    • have the user select an option to determine if the phase to be entered is in degrees or radians and return an error if some other selection is entered. Again, use a one (1) to represent the first option and a two (2) to represent the second. Return an error if anything else is entered here besides a one or a two. Re-enter the value if this occurs. Reminder: 1 radian = 180/π degrees.
    • have the user enter in the complex number with the magnitude and phase.
    • convert this complex number to its equivalent in rectangular form x + jy and call it CP1.
    • plot this complex number on a real vs. imaginary plot. Use a red asterick to mark the point. (Consider the real data to be on the x-axis and the imaginary data to be on the y-axis). Include a title “The rectangular form of CP1 is x + jy” and replace x and y with the appropriate data.
    • prompt the user to enter in the real and imaginary parts of another complex number. Call it CP2.
    • return an error if CP1 = CP2 and re-enter CP2 if this occurs.
    • prove/show that rCP 1 ∗CP 2 = rCP 1 ∗ rCP 2 and prove/show that θCP 1 ∗CP 2 = θCP 1 + θCP 2.
  3. If the user selects the rectangular form option:
    • have the user enter in the complex number with the real part first and the imaginary part second.
    • convert this complex number to its equivalent in polar form rejθ^ and call it CP1.
    • plot CP1 on a polar plot. Mark it with a red asterick.
    • Add a title “The polar form of CP1 is rejθ”. Replace r and θ with the appropriate data.
    • prompt the user to enter in the magnitude and phase (in radians) of CP2. Return an error if CP1 = CP2 and re-enter CP2 if this occurs.
    • prove/show that rCP 1 /CP 2 = rCP 1 /rCP 2 and prove/show that θCP 1 /CP 2 = θCP 1 − θCP 2.

Remember:

  • Complex numbers written as x = a + jb are considered to be in the rectangular form.
  • A complex number can also be written in the polar form where x = rejθ^ = rcosθ + jrsinθ
  • MATLAB calculations with complex numbers are done with phase being in radians, not degrees.

Lab Report

  • Document what you did in the report; include both MATLAB code and an explanation of what your code does. Also include the required plots. You have two weeks to complete this lab.