From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to access the numerator and denominator of a transfer function object within mathscript%3F

I'm using the mathscript window/editor. I have a transfer function object, G, and need to get the numerator and denominator information. In Matlab I simply type,

 

num = G.num{1};

den = G.den{1};

 

This does not work in LabVIEW. How can I access the numerator and denominator in LabVIEW?

 

0 Kudos
Message 1 of 6
(4,194 Views)

Hello Southern_Cross,

 

If I remember correctly, that function returns the coefficients of the transfer function on either the numerator or denominator. If you have the System Identification Toolkit, there are several functions available that you might be able to use to accomplish this in LabVIEW:

 

SI Get Continuous Transfer Function Denominator Info

http://zone.ni.com/reference/en-XX/help/372458D-01/lvsysid/get_continuous_tf_denominator_info/

 

SI Get Coefficients from System Model VI

http://zone.ni.com/reference/en-XX/help/371894H-01/lvsysid/get_coeff_from_sys_model/

 

On that second function, it outputs the coefficients of both the numerator and the denominator which you will probably find more helpful.

Erin D.
0 Kudos
Message 2 of 6
(4,165 Views)

Thanks for the comments, but, I'm trying to learn how to do this from mathscript. So, I need a text solution.

0 Kudos
Message 3 of 6
(4,156 Views)

When you say that this does not work, what are you seeing in your Output Window? There's a possibility that what you are using is not a supported function.

 

Here is a link for the supported functions in LabVIEW:

 

MathScript RT Module Functions

http://zone.ni.com/reference/en-XX/help/373123C-01/lvtextmath/msfunc_classes/

Erin D.
0 Kudos
Message 4 of 6
(4,143 Views)

I think that it's clear that it's not supported.

 

My feedback is that when using the mathscript window there does not appear to be any way to access the numerator nor denominator of a transfer function system. 

 

To illustrate, in Matlab I can access them using,

 

>> sys = tf(1, [1 2 4]);

>> sys.num{1}

ans = 0 0 1

>> sys.den{1}

ans = 1 2 4

 

In LabVIEW Mathscript I get the following error,

 

>>sys = tf(1, [1 2 4]);

>>sys.num{1}

Error in function . at line 1 column 4: You cannot use the "." operator to dereference data that is not a structure.

 

Given the data structure LabVIEW is using... is there a way to access the numerator/denominator from the 'sys' model textually in a mathscript window?

 

Thanks.

0 Kudos
Message 5 of 6
(4,117 Views)

The following help documents show functions that can give outputs of den and nom:

 

get (MathScript RT Module Function)

http://zone.ni.com/reference/en-XX/help/371894H-01/lvcdtextmath/cdmc_get/

 

tfinfo (MathScript RT Module Function)

http://zone.ni.com/reference/en-XX/help/371894H-01/lvcdtextmath/cdmc_tfinfo/

 

It may also be helpful to look back at the tf function too:

 

tf (MathScript RT Module Function)

http://zone.ni.com/reference/en-XX/help/371894H-01/lvcdtextmath/cdmc_tf/

Erin D.
0 Kudos
Message 6 of 6
(4,103 Views)