In this problem, we are given three integer values W, n, m denoting the length of wall W, size of shelves n, and m. Our task is To Create a Program to solve the Fitting Shelves Problem.We need to find a way to fit shelves in such a way that the space left after fitting shelves is minimized. A secondary constrain while solving is the cost of making, the larger shelves are more cost-effective so, we need to give them a priority.The output should be in the following form, Number of n size shelves number of m size shelves space ... Read More
Z-TransformThe Z-transform is a mathematical tool which is used to convert the difference equations in discrete time domain into the algebraic equations in z-domain. Mathematically, if $\mathrm{\mathit{x\left ( n \right )}}$ is a discrete time function, then its Z-transform is defined as, $$\mathrm{\mathit{Z\left [ x\left ( n \right ) \right ]\mathrm{\, =\, }X\left ( z \right )\mathrm{\, =\, }\sum_{n\mathrm{\, =\, }-\infty }^{\infty }x\left ( n \right )z^{-n}}}$$Solving Difference Equations by Z-TransformIn order to solve the difference equation, first it is converted into the algebraic equation by taking its Z-transform. Then, the solution of the equation is calculated in z-domain and ... Read More
Z-TransformThe Z-transform is a mathematical tool which is used to convert the difference equations in discrete time domain into the algebraic equations in z-domain. Mathematically, if $\mathrm{\mathit{x\left ( n \right )}}$ is a discrete time function, then its Z-transform is defined as, $$\mathrm{\mathit{Z\left [ x\left ( n \right ) \right ]\mathrm{\, =\, }X\left ( z \right )\mathrm{\, =\, }\sum_{n\mathrm{\, =\, }-\infty }^{\infty }x\left ( n \right )z^{-n}}}$$Inverse Z-Transform using Residue MethodThe residue method is also known as complex inversion integral method. As the Z-transform of a discrete-time signal $\mathrm{\mathit{x\left ( n \right )}}$ is defined as$$\mathrm{\mathit{Z\left [ x\left ( n ... Read More
Z-TransformThe Z-transform is a mathematical tool which is used to convert the difference equations in discrete time domain into the algebraic equations in z-domain. Mathematically, if $\mathrm{\mathit{x\left ( n \right )}}$ is a discrete time function, then its Z-transform is defined as, $$\mathrm{\mathit{Z\left [ x\left ( n \right ) \right ]\mathrm{\, =\, }X\left ( z \right )\mathrm{\, =\, }\sum_{n\mathrm{\, =\, }-\infty }^{\infty }x\left ( n \right )z^{-n}}}$$Time Expansion Property of Z-TransformStatement – The time expansion property of Z-transform states that if$$\mathrm{\mathit{x\left ( n \right )\overset{ZT}{\leftrightarrow}X\left ( z \right );\; \; \; \mathrm{ROC}\to \mathit{R}}} $$Then$$\mathrm{\mathit{x_{m}\left ( n \right )\overset{ZT}{\leftrightarrow}X\left ( z^{m} ... Read More
Z-TransformThe Z-transform is a mathematical tool which is used to convert the difference equations in discrete time domain into the algebraic equations in z-domain. Mathematically, if $\mathrm{\mathit{x\left ( n \right )}}$ is a discrete time function, then its Z-transform is defined as, $$\mathrm{\mathit{Z\left [ x\left ( n \right ) \right ]\mathrm{\, =\, }X\left ( z \right )\mathrm{\, =\, }\sum_{n\mathrm{\, =\, }-\infty }^{\infty }x\left ( n \right )z^{-n}}}$$Multiplication Property of Z-TransformStatement – The multiplication property of Z-transform states that the multiplication of two signals in time domain corresponds to the complex convolution in z-domain. For this reason, the multiplication property is ... Read More
Frequency Response of Discrete-Time SystemsA spectrum of input sinusoids is applied to a linear time invariant discrete-time system to obtain the frequency response of the system. The frequency response of the discrete-time system gives the magnitude and phase response of the system to the input sinusoids at all frequencies.Now, let the impulse response of an LTI discrete-time system is $\mathit{h}\mathrm{\left(\mathit{n}\right)}$ and the input to the system is a complex exponential function, i.e., $\mathit{x}\mathrm{\left(\mathit{n}\right)}\:\mathrm{=}\:\mathit{e^{\mathit{j\omega n}}}$. Then, the output $\mathit{y}\mathrm{\left(\mathit{n}\right)}$ of the system is obtained by using the convolution theorem, i.e., $$\mathrm{\mathit{y}\mathrm{\left(\mathit{n}\right)}\:\mathrm{=}\:\mathit{h}\mathrm{\left(\mathit{n}\right)}*\mathit{x}\mathrm{\left(\mathit{n}\right)}\:\mathrm{=}\:\sum_{\mathit{k=-\infty} }^{\infty}\mathit{h}\mathrm{\left(\mathit{k}\right)}\mathit{x}\mathrm{\left(\mathit{n-k}\right)}}$$As the input to the system is $\mathit{x}\mathrm{\left(\mathit{n}\right)}\:\mathrm{=}\:\mathit{e^{\mathit{j\omega n}}}$ ,then, ... Read More
The req.method property contains a string that corresponds to the HTTP methods of the request which are GET, POST, PUT, DELETE, and so on...These methods are based upon the requests sent by the user. All the above methods have different use-cases.Syntaxreq.methodExample 1Create a file with the name "reqMethod.js" and copy the following code snippet. After creating the file, use the command "node reqMethod.js" to run this code as shown in the example below −// req.method Property Demo Example // Importing the express & cookieParser module var cookieParser = require('cookie-parser'); var express = require('express'); // Initializing the express and ... Read More
The router.route() method returns the instance of a single route which can be used to handle the HTTP verbs further with the optional middleware. This method can be used to avoid duplicate route naming and therefore the typing errors.Syntaxrouter.route( path )Example 1Create a file with the name "routerRoute.js" and copy the following code snippet. After creating the file, use the command "node routerRoute.js" to run this code as shown in the example below −// router.route() Method Demo Example // Importing the express module var express = require('express'); // Initializing the express and port number var app = express(); ... Read More
The res.attachment() method is used for setting the Content-Disposition header field to "attachment". If a filename is passed, then it sets the Content-type based on the extension name that is retrieved from the res.type(). It sets the Content-Disposition "filename" field with the parameter.Syntaxres.attachment()Example 1Create a file with the name "resAttachment.js" and copy the following code snippet. After creating the file, use the command "node resAttachment.js" to run this code as shown in the example below −// res.attachment() Method Demo Example // Importing the express var express = require('express'); // Initializing the express and port number var app = ... Read More
The req.params property is an object that contains the properties which are mapped to the named route "parameters". For example, if you have a route as /api/:name, then the "name" property is available as req.params.name. The default value of this object is {}.Syntaxreq.paramsExample 1Create a file with the name "reqParams.js" and copy the following code snippet. After creating the file, use the command "node reqParams.js" to run this code as shown in the example below −// req.params Property Demo Example // Importing the express var express = require('express'); // Initializing the express and port number var app = ... Read More