Skip to content
LIBRARY
Math.RectangularToPolar.md

Math.RectangularToPolar

Converts rectangular coordinates to polar coordinates.

Computes the polar representation from rectangular (Cartesian) inputs:

Usage

BlockComponents.Math.RectangularToPolar()

Connectors

  • u_re - This connector represents a real signal as an input to a component (RealInput)

  • u_im - This connector represents a real signal as an input to a component (RealInput)

  • y_abs - This connector represents a real signal as an output from a component (RealOutput)

  • y_arg - This connector represents a real signal as an output from a component (RealOutput)

Behavior

Source

dyad
"""
Converts rectangular coordinates to polar coordinates.

Computes the polar representation from rectangular (Cartesian) inputs:

```math
y_{\\text{abs}} = \\sqrt{u_{\\text{re}}^2 + u_{\\text{im}}^2}
```
```math
y_{\\text{arg}} = \\operatorname{atan2}(u_{\\text{im}}, u_{\\text{re}})
```
"""
component RectangularToPolar
  "Real part of the rectangular representation"
  u_re = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 160, "x2": 0, "y2": 260, "rot": 0}
      },
      "tags": []
    }
  }
  "Imaginary part of the rectangular representation"
  u_im = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 690, "x2": 0, "y2": 790, "rot": 0}
      },
      "tags": []
    }
  }
  "Absolute value (length) of the polar representation"
  y_abs = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 160, "x2": 1100, "y2": 260, "rot": 0}
      },
      "tags": []
    }
  }
  "Angle of the polar representation"
  y_arg = RealOutput(units = "rad") {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 720, "x2": 1100, "y2": 820, "rot": 0}
      },
      "tags": []
    }
  }
relations
  "Computes the absolute value from rectangular components"
  y_abs = sqrt(u_re * u_re + u_im * u_im)
  "Computes the angle from rectangular components"
  y_arg = atan(u_im, u_re)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/RectangularToPolar.svg"}
  }
}
end
Flattened Source
dyad
"""
Converts rectangular coordinates to polar coordinates.

Computes the polar representation from rectangular (Cartesian) inputs:

```math
y_{\\text{abs}} = \\sqrt{u_{\\text{re}}^2 + u_{\\text{im}}^2}
```
```math
y_{\\text{arg}} = \\operatorname{atan2}(u_{\\text{im}}, u_{\\text{re}})
```
"""
component RectangularToPolar
  "Real part of the rectangular representation"
  u_re = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 160, "x2": 0, "y2": 260, "rot": 0}
      },
      "tags": []
    }
  }
  "Imaginary part of the rectangular representation"
  u_im = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 690, "x2": 0, "y2": 790, "rot": 0}
      },
      "tags": []
    }
  }
  "Absolute value (length) of the polar representation"
  y_abs = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 160, "x2": 1100, "y2": 260, "rot": 0}
      },
      "tags": []
    }
  }
  "Angle of the polar representation"
  y_arg = RealOutput(units = "rad") {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 720, "x2": 1100, "y2": 820, "rot": 0}
      },
      "tags": []
    }
  }
relations
  "Computes the absolute value from rectangular components"
  y_abs = sqrt(u_re * u_re + u_im * u_im)
  "Computes the angle from rectangular components"
  y_arg = atan(u_im, u_re)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/RectangularToPolar.svg"}
  }
}
end


Test Cases

No test cases defined.