Git Product home page Git Product logo

c2d_euler-matlab's Introduction

c2d_euler View Euler c2d Transformation (c2d_euler) on File Exchange

Transforms a continuous transfer function to a discrete transfer function using the forward and backward Euler methods.

Syntax

Hz = c2d_euler(Hs,T,type)
Hz = c2d_euler(Hs,T,type,output,normalize)

Inputs

  • Hs (1×1 'tf' or 'zpk'): continuous transfer function
  • T (1×1 double): sampling period
  • type (char array): 'forward' or 'backward
  • output (OPTIONAL) (char array): specifies output type ('tf' or 'zpk') (defaults to 'tf')
  • normalize (OPTIONAL) (1×1 logical) true if transfer function should be normalized, false otherwise (defaults to false)

Outputs

  • Hz (1×1 tf or zpk): discrete transfer function

Examples and Additional Documentation

c2d_euler-matlab's People

Contributors

tamaskis avatar

Stargazers

 avatar

Watchers

 avatar

c2d_euler-matlab's Issues

Scaling coefficients in 'tf' output

I was working with a PID controller designed by MATLAB PID Tuner toolbox. The resulting controller is

C_PID =
 
  1.179 s^2 + 26.57 s + 91.11
  ---------------------------
               s
 
Continuous-time transfer function.

Converting it into a discrete-time system produces extremely large values for the coefficients:

>> c2d_euler(C_PID, .1, 'forward')

ans =
 
  6.639e16 z^2 + 1.679e16 z - 3.188e16
  ------------------------------------
         5.629e15 z - 5.629e15
 
Sample time: 0.1 seconds
Discrete-time transfer function.

The reason is probably that the numerical precision associated with the parameters of the designed PID controller is extremely high (which may be unnecessary in most cases). Although this is a valid output, for a better-looking result and a more simplified form of the transfer function, I suggest normalizing the fraction by the coefficient of the largest power of z in the denominator.

In that case we have:

ans =
 
  11.79 z^2 + 2.982 z - 5.663
  ---------------------------
             z - 1
 
Sample time: 0.1 seconds
Discrete-time transfer function.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.