Skip to main content
Glama

z_transform

Compute the Z-transform of a discrete-time function to analyze signals and systems in the frequency domain by specifying the function, time variable, and Z-transform variable.

Instructions

Calculate the Z-transform of a function

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYesFunction of discrete time
limitNoUpper limit for summation (default: 100)
timeVarYesDiscrete time variable
zVarYesZ-transform variable

Implementation Reference

  • The zTransform function implements the core logic for calculating the Z-transform of a discrete-time function using a finite series approximation up to the specified limit.
    const zTransform = (expr, n, z, limit = 100) => { try { const node = math.parse(expr); let result = math.complex(0, 0); for (let k = 0; k <= limit; k++) { const scope = { [n]: k }; const fn = math.evaluate(node, scope); const zTerm = math.pow(z, -k); result = math.add(result, math.multiply(fn, zTerm)); } return result.toString(); } catch (e) { return `Error: ${e.message}`; } };
  • index.js:473-488 (registration)
    Registers the 'z_transform' tool using ai.defineTool, specifying name, description, input and output schemas, and an async handler that invokes the zTransform function.
    ai.defineTool( { name: 'z_transform', description: 'Calculate the Z-transform of a function', inputSchema: z.object({ expression: z.string().describe('Function of discrete time'), timeVar: z.string().describe('Discrete time variable'), zVar: z.string().describe('Z-transform variable'), limit: z.number().optional().describe('Upper limit for summation (default: 100)') }), outputSchema: z.string(), }, async ({ expression, timeVar, zVar, limit = 100 }) => { return zTransform(expression, timeVar, zVar, limit); } );
  • Zod schema definition for the z_transform tool inputs (expression, timeVar, zVar, optional limit) and string output.
    inputSchema: z.object({ expression: z.string().describe('Function of discrete time'), timeVar: z.string().describe('Discrete time variable'), zVar: z.string().describe('Z-transform variable'), limit: z.number().optional().describe('Upper limit for summation (default: 100)') }), outputSchema: z.string(),

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nbiish/mcp-calc-tools'

If you have feedback or need assistance with the MCP directory API, please join our Discord server