File:ACPower-en.svg

Summary

Description
English: Current, voltage, power and average power for AC circuits. Similar to File:ACPower02CJC.png. Created using Python / Matplotlib.
Date
Source Own work
Author Åshild Telle
Other versions File:ACPower-no.svg, File:ACPower-nolabels.svg
SVG development
InfoField
Source code
InfoField

Python code

import numpy as np
import matplotlib.pyplot as plt


def current(i_hat, omega, theta_u, theta_i, r):
    return i_hat*np.cos(omega*r + theta_u - theta_i)

def voltage(u_hat, omega, r):
    return u_hat*np.cos(omega*r)

def power(P, omega, r):
    return P + P*np.cos(2*omega*r)

# parameteres

omega = theta_u = theta_i = P = 1
u_hat = 3
i_hat = 2

# x axes

rad = np.linspace(0, 2*np.pi, 100)
deg = np.linspace(0, 360, 100)

# y axes

v = voltage(u_hat, omega, rad)
c = current(i_hat, omega, theta_u, theta_i, rad)
p = power(P, omega, rad)
a = np.mean(p)*np.ones(100)

# plot values

for y in (v, c, p, a):
    plt.plot(deg, y, linewidth=2)

plt.xlabel("Degrees", fontsize=10)
plt.ylabel("Volt (V) / Ampere (A) / Watt (W) / Watt (W)", fontsize=10)
plt.legend(["Voltage", "Current", "Power", "Average"], loc=4, fontsize=15)
plt.savefig("ACPower-en.svg")
plt.show()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#ACPower-en.svg
Category:Self-published work Category:Electricity diagrams Category:AC waves
Category:AC waves Category:CC-Zero Category:Electricity diagrams Category:Self-published work Category:Valid SVG created with Matplotlib code