Energy and Power Signal

Hi friends, in this tutorial we are going to learn about Energy and Power signal in Signals and Systems.

Energy and Power Signal

A) Power Signals

There are three power signals:

  1. Instantaneous power
  2. normalized power
  3. Average normalized power

Let’s see each type one by one.

Instantaneous power

An instantaneous power across resistor R is given by

Here V is the voltage across the resistor R. Let us consider that this voltage is represented by x(t) then above equation becomes

Similarly, in terms of current, we can write,

If we say current is denoted by x(t), then we can get

Normalized power

Every time we don’t know if x(t) is a current signal or voltage signal. therefore to make power equation independent of nature of x(t), we will normalize it by putting R = 1, thus the equation 2) and 4) becomes

Average normalized power

average normalized power is given by,

  • Here magnitude of x(t) is written so this equation is also applicable if x(t) is complex
  • Integration is taken from -T0/2 to T0/2 that is it means, it is from entire time period T0
  • Considering T0 as average value, integration term is multiplied by 1/T0

Based on all the above equations we can define power signal as below

Definition of Power Signal

A signal x(t) is said to be power signal is its normalized average power is non-zero and finite. thus for the power signals the normalized average power, P is finite and non-zero.

For the discrete time signals, average power P is given by,

In above equation, it is expected that N>>1

B) Energy Signal

The total normalized energy for a real signal x(t) is given by

but if the signal x(t) is complex then we can write above equation as

Definition of energy signal

A signal x(t) is said to be an energy signal if its normalized energy is non-zero and finite. Hence for the energy signals, the total normalized energy (E) is non-zero and finite.

The energy of discrete time signal is denoted by E, it is given by,

You can remember the conditions for Energy and Power signal using below table.

Power of the energy signals

Let us consider, x(t) is an energy signal. i.e. x(t) has a finite non-zero energy. let us calculate the power of x(t). By definition, explained in equation no. 6) the power of x(t) is given by

Therefore we can say that the power of energy signal is zero over a finite time.

Energy of a power signal

Let us consider, x(t) be a power signal. The normalized energy of this signal is given by,

This equation can be written as,

Therefore we can say that energy of a power signal is infinite over a finite time.

Comparison of Energy and Power Signals

Power Signals Energy Signals
1. The signal having finite non-zero power are called as Power Signals 1. The signals having finite non-zero energy are called as energy signals
2. Almost all the periodic signals in practice are power signals 2. Almost all the nonperiodic signals are energy signals
3. ower signals can exist over an infinite time. They are not time-limited 3. Energy signals exist over a short period of time. They are time limited
4. The energy of a power signal is infinite 4. Power of an energy signal is zero

I hope you liked this article on Energy and Power Signal. Please like our facebook page and subscribe to our newsletter for future updates. If you have any questions, feel free to ask in the comment section below. Have a great time 🙂

Convert Excel to JSON using JavaScript code

Hello friends, in this javascript tutorial we are going to learn about how to Convert Excel to JSON using JavaScript code. We can read an excel file which is hosted on any server, SharePoint folder, etc with the help of javascript code. Here you can get readymade javascript code for Excel to JSON conversion.

Excel to JSON
Excel to JSON

Convert Excel to JSON using JavaScript Code

In this tutorial, we are going to use a js-xlsx library to convert Excel to JSON. It has xlsx.full.min.js file which we are going to refer in our HTML file. js-xlsx is a parser and writer for various spreadsheet formats. So without wasting time lets jump to coding part. We can also use .csv files as well.

Below is a code for reading Excel as a JSON object:

<!doctype html>
<html>

<head>
    <title>Excel to JSON Demo</title>
    <script src="xlsx.full.min.js"></script>
</head>

<body>

    <script>
        /* set up XMLHttpRequest */
        var url = "https://myclassbook.org/wp-content/uploads/2017/12/Test.xlsx";
        var oReq = new XMLHttpRequest();
        oReq.open("GET", url, true);
        oReq.responseType = "arraybuffer";

        oReq.onload = function(e) {
            var arraybuffer = oReq.response;

            /* convert data to binary string */
            var data = new Uint8Array(arraybuffer);
            var arr = new Array();
            for (var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
            var bstr = arr.join("");

            /* Call XLSX */
            var workbook = XLSX.read(bstr, {
                type: "binary"
            });

            /* DO SOMETHING WITH workbook HERE */
            var first_sheet_name = workbook.SheetNames[0];
            /* Get worksheet */
            var worksheet = workbook.Sheets[first_sheet_name];
            console.log(XLSX.utils.sheet_to_json(worksheet, {
                raw: true
            }));
        }

        oReq.send();
    </script>
</body>

</html>

In the above code, if you could observe, you will find that we have used xlsx.full.min.js file and a Test.xlsx file. We are going to read Test.xlsx Excel file to generate a JSON Object.

Note: While using above code make sure that you have uploaded your Excel file on any server and give the correct full path of that file. You can use the same code to convert CSV to JSON.

Here is our Test.xlsx file which looks like below

Output

When you host your index.html file on the server, on the page load we are running our script to show the objects in the browser console. Below is the output in JSON object

JSON Object output
JSON Object output

Download Excel to JSON javascript

You can use any one of the links to download the source code

  1. MyClassBook: Download
  2. Google Drive: Download
  3. MediaFire: Download

I hope you liked this article. Please let us know if you face any issues in the comment sections below. Like our facebook page and subscribe to our newsletter for future updates. Have a great time! 🙂