How to change the Numerator coefficients parameter of Transfer Fcn module in simulink dynamiclly?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to change the Numerator coefficients parameter of Transfer Fcn module in simulink dynamiclly?

Jump to solution
1,609 Views
edenli
Contributor V

Hi Guys,

I met a question when built the simulink model.

I wanna change the munerator coefficients parameter of Transfer Fcn dynamiclly,but pop up an error,i don't know how to deal with it .

the modle is below:

183566_183566.pngpastedImage_1.png

pop up the error:

183567_183567.pngpastedImage_2.png

The attachment is the model.

Original Attachment has been moved to: Model_1.slx.zip

1 Solution
1,339 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi Eden Li, 

This has nothing to do with the modelling - it is pure math, especially control system theory :-) What are you trying to do is not accurate - you can't swap the coefficient from Laplace domain to Z-domain

First of all the H(s) is a continuous function and before calculating the Z-transform of H(s) you need to sample . What you want is to convert the H(s) -> H(z) by calculating the Z-transform of h(t) sampled of different intervals T and is know as inverse Laplace transform of H(s)

My recommendation is to read these Mathworks articles about continuous2discrete and discrete2continuous transformations.

After that you should get similar waveforms.

Hope this helps!

Best regards,
Daniel 

View solution in original post

6 Replies
1,340 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi Eden Li, 

That is a Matlab limitation for standard transfer function block that can be easily workaround via:

#1: mathematical approach, to create the transfer function representation via Simulink basic ADD/MULTIPLY/INTEGRATOR/DERIVATIVE blocks in which we can add DATA STORE READ inputs.

1.JPG

#2: mimic - reuse other blocks that allows DATA READ to mimic the functionality of standard transfer function block. One example might be PID controller block that can be easily transformed in a 1st or 2nd order transfer function, depending on the options highlighted below.

2.JPG

Note that these 2 approaches works for both S and Z domains

Perhaps others might know better ways. Please leave a comment below for any other approach.

Best regards,
Daniel

0 Kudos
1,340 Views
edenli
Contributor V

Hi Daniel,

I can not allocate parameter of pid module ,making the partA equal to PartB?

pastedImage_3.png

PID module show as below:

pastedImage_1.png

0 Kudos
1,340 Views
dumitru-daniel_
NXP Employee
NXP Employee

For digital transfer function we can add the DATA READ directly because it is supported in the UI

1.jpg

And you'll have something like this:

2.JPG

For the suggestion with "mimic" you need to play a bit with the maths - since it is not straightforward like using a single block.

Here is a glace of what you can do:

 Capture.JPG

Hope this helps!

Daniel

1,340 Views
edenli
Contributor V

Hi Daniel,

The two ways above to solve the  theme is valid,but i come across another question,the constant 8 inputs the Discrete Transfer Fcn and the  continuous Transfer Fcn at same time,but the result is great defference.i changed a lot of parameter about the Discrete Transfer Fcn ,but result is not improment.

pastedImage_1.png

0 Kudos
1,340 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi Eden Li, 

This has nothing to do with the modelling - it is pure math, especially control system theory :-) What are you trying to do is not accurate - you can't swap the coefficient from Laplace domain to Z-domain

First of all the H(s) is a continuous function and before calculating the Z-transform of H(s) you need to sample . What you want is to convert the H(s) -> H(z) by calculating the Z-transform of h(t) sampled of different intervals T and is know as inverse Laplace transform of H(s)

My recommendation is to read these Mathworks articles about continuous2discrete and discrete2continuous transformations.

After that you should get similar waveforms.

Hope this helps!

Best regards,
Daniel 

1,340 Views
edenli
Contributor V

Hi Daniel,

Thank you very much! you give me a hint!Now i solved the question!

Best Regards!

Eden Li

0 Kudos