Jump to content
Sign in to follow this  

Discrete Transfer Function Problem

Recommended Posts

Hi guys,


I'm having some problems with the discrete Transfer Function block. I'm trying to recreate the TF behavior I'm getting from Matlab, but I'm nowhere near. I have tried using both the Polynomial and the Poles and Zeros option to enter the values, but the output remains the same. 


 z^4 - 3.753 z^3 + 5.272 z^2 - 3.286 z + 0.7666 / 4.421e-07 z^4 - 4.333e-07 z^3


I've attached my Embed file, that contains the Reference and the TF blocks. I've also included a couple of screenshots from Matlab that show the behavior I'd like to obtain from Embed.

I've made sure that Embed and Matlab have the same Time Step, which you'll be able to see from the reference input (it's the same on both softwares). I don't know what else to do, I really hope you can help me out.









Share this post

Link to post
Share on other sites

Hi Joshep,


You need to be careful when using discrete transfer functions.  The values to the right of the decimal are very important, if you truncate them you can get significantly different results. 


I applied the "reg" signal created from the two "Bezier" blocks to three transfer functions; 
1.  The transfer function typed into this correspondance (red)
2.  The transfer function from your .vsm model executed on a 64 bit computer (blue)
3.  Same as 2. but executed on a 32 bit computer (green)

On the traces below, you'll see how important it is not to truncate coefficients by comparing the red response with either the blue or green.  The blue response is the correct response.  If you had codegen'd the transfer function and run that code on a 32 bit microcontroller, you'd get the green response which clearly has some noise problems.  


I've also attached the model used to generate these responses. 




Sreeram Mohan likes this

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...