summaryrefslogtreecommitdiff
path: root/Digital_Signal_Processing_by_S_Salivahanan/4-Z_Transforms.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Digital_Signal_Processing_by_S_Salivahanan/4-Z_Transforms.ipynb')
-rw-r--r--Digital_Signal_Processing_by_S_Salivahanan/4-Z_Transforms.ipynb229
1 files changed, 229 insertions, 0 deletions
diff --git a/Digital_Signal_Processing_by_S_Salivahanan/4-Z_Transforms.ipynb b/Digital_Signal_Processing_by_S_Salivahanan/4-Z_Transforms.ipynb
new file mode 100644
index 0000000..84a06bb
--- /dev/null
+++ b/Digital_Signal_Processing_by_S_Salivahanan/4-Z_Transforms.ipynb
@@ -0,0 +1,229 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 4: Z Transforms"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.13: Convolution.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Example 4.13\n",
+"\n",
+"clc;clear;close;\n",
+"z=poly(0,'z');\n",
+"x1=[4 -2 1];n1=0:length(x1)-1;\n",
+"X1=x1*(z^-n1)';\n",
+"x2=[1 1 1 1 1];n2=0:length(x2)-1;\n",
+"X2=x2*(z^-n2)';\n",
+"X3=X1*X2;\n",
+"l=coeff(numer(X3));\n",
+"x3=l(:,$:-1:1);\n",
+"disp(X1,'x1(n)={4,-2,1} X1(z)=');\n",
+"disp(X2,'x2(n)={1,1,1,1,1} X2(z)=');\n",
+"disp(X3,'Z transform of convolution of the two signals X3(z)=');\n",
+"disp(x3,'Convolution result of the two signals= ')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.14: Convolution.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Example 4.14\n",
+"\n",
+"clc;clear;close;\n",
+"z=poly(0,'z');\n",
+"x1=[2 1 0 0.5];n1=0:length(x1)-1;\n",
+"X1=x1*(z^-n1)';\n",
+"x2=[2 2 1 1];n2=0:length(x2)-1;\n",
+"X2=x2*(z^-n2)';\n",
+"X3=X1*X2;\n",
+"l=coeff(numer(X3));\n",
+"x3=l(:,$:-1:1);\n",
+"disp(X1,'x1(n)={2,1,0,0.5} X1(z)=');\n",
+"disp(X2,'x2(n)={2,2,1,1} X2(z)=');\n",
+"disp(X3,'Z transform of convolution of the two signals X3(z)=');\n",
+"disp(x3,'Convolution result of the two signals= ')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.16: Cross_correlatio.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Example 4.16\n",
+"\n",
+"clc;clear;close;\n",
+"z=poly(0,'z');\n",
+"x1=[1 2 3 4];n1=0:length(x1)-1;\n",
+"X1=x1*(z^-n1)';\n",
+"x2=[4 3 2 1];n2=0:length(x2)-1;\n",
+"X2=x2*(z^-n2)';\n",
+"X2_=x2*(z^n2)';\n",
+"X3=X1*X2_;\n",
+"l=coeff(numer(X3));\n",
+"x3=l(:,$:-1:1);\n",
+"disp(X1,'x1(n)={4,-2,1} X1(z)=');\n",
+"disp(X2,'x2(n)={4,-2,1} X2(z)=');\n",
+"disp(X3,'Z transform of cross crrelation of the two signals X3(z)=');\n",
+"disp(x3,'Cross correlation result of the two signals= ')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.19: System_response.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Example 4.19\n",
+"\n",
+"clc;clear;close;\n",
+"z=poly(0,'z');\n",
+"h=[1 2 3];n1=0:length(h)-1;\n",
+"H=h*(z^-n1)';\n",
+"y=[1 1 2 -1 3];n2=0:length(y)-1;\n",
+"Y=y*(z^-n2)';\n",
+"X=Y/H;\n",
+"l=coeff(numer(X));\n",
+"x=l(:,$:-1:1);\n",
+"disp(H,'h(n)={1,2,3} H(z)=');\n",
+"disp(Y,'y(n)={1,1,2,-1,3} Y(z)=');\n",
+"disp(X,'Z transform of input sequence X(z)=');\n",
+"disp(x,'Inpput Sequence = ')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.2: Z_transform.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Example 4.2\n",
+"\n",
+"clc;clear;close;\n",
+"z=poly(0,'z');\n",
+"x1=[3 1 2 5 7 0 1];n1=-3:3;\n",
+"X1=x1*(z^-n1)';\n",
+"x2=[2 4 5 7 0 1 2];n2=-2:4;\n",
+"X2=x2*(z^-n2)';\n",
+"x3=[1 2 5 4 0 1]; n3=0:5;\n",
+"X3=x3*(z^-n3)';\n",
+"x4=[0 0 1 2 5 4 0 1];n4=0:7;\n",
+"X4=x4*(z^-n4)';\n",
+"X5=z^0;\n",
+"X6=z^-5;\n",
+"X7=z^5;\n",
+"disp(X1,'x1(n)={3,1,2,5,7,0,1} X1(z)=');\n",
+"disp(X2,'x2(n)={2,4,5,7,0,1,2} X2(z)=');\n",
+"disp(X3,'x3(n)={1,2,5,4,0,1} X3(z)=');\n",
+"disp(X4,'x4(n)={0,0,1,2,5,4,0,1} X4(z)=');\n",
+"disp(X5,'x5(n)=delta(n) X5(z)=');\n",
+"disp(X6,'x6(n)=delta(n-5) X6(z)=');\n",
+"disp(X7,'x7(n)=delta(n+5) X7(z)=');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4.4: Z_transform.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Example 4.4\n",
+"\n",
+"clc;clear;close;\n",
+"z=poly(0,'z');\n",
+"x=[1 3 0 0 6 -1];n=-1:4;\n",
+"X=x*(z^-n)';\n",
+"disp(X,'x(n)={1,3,0,0,6,-1} X(z)=');"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}