<div dir="ltr"><div>Hi,</div><div><br></div>Another way to represent filter in Xcos is to use the Discrete State-Space (DLSS) block. The matrices can be obtained directly from the syslin representation of the system:<div><br></div><div>[A1 B1 C1 D1] = abcd(H1);</div><div>[A2 B2 C2 D2] = abcd(H2);<br></div><div><br></div><div>(This transformation can also be set in Xcos context)</div><div><br></div><div>Yours</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-04-02 23:45 GMT+09:00 Tan Chin Luh-2 [via Scilab / Xcos - Mailing Lists Archives] <span dir="ltr"><<a href="/user/SendEmail.jtp?type=node&node=4036118&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>></span>:<br><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="m_-3606187236817741134moz-cite-prefix">you're welcome. <br>
anyway it should be a better way to construct the denominator, do
let me know if you find a better way. :)<br>
<br>
rgds,<br>
CL<div><div class="h5"><br>
<br>
<br>
On 2/4/2017 12:22 AM, Nikolay Strelkov wrote:<br>
</div></div></div><div><div class="h5">
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em" type="cite">
<div dir="ltr">
<div>
<div>Dear Tan Chin Luh!<br>
<br>
</div>
Thank you very much.<br>
</div>
It works as expected!<br>
<div class="gmail_extra">
<div>
<div class="m_-3606187236817741134gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div class="m_-3606187236817741134gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div>The problem is solved.<br>
</div>
<div dir="ltr"><br>
--<br>
</div>
<div><i>With best regards,<br>
<span lang="en"><span>Ph.D., </span></span></i><i><span lang="en"><span>associate</span>
professor at <a href="http://mpei.ru/lang/en/Pages/default.aspx" rel="nofollow" link="external" target="_blank">MPEI</a>,<br>
</span><span>IEEE member,</span><br>
maintainer of <a href="http://atoms.scilab.org/toolboxes/Mathieu/" rel="nofollow" link="external" target="_blank">Mathieu functions
toolbox for Scilab</a>,<br>
<span>Nikolay</span> Strelkov.</i><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">2017-04-01 17:23 GMT+03:00 Tan Chin
Luh <span dir="ltr"><<a href="http:///user/SendEmail.jtp?type=node&node=4036111&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>></span>:<br>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote">
<div bgcolor="#FFFFFF" text="#000000">
<div class="m_-3606187236817741134m_3879002882047539259moz-cite-prefix">Hi,<br>
<br>
If I understand correctly, you would like to create
the filter in Scilab, and directly access from Xcos?<br>
if so, u could use the syslin object to do so.<br>
<br>
1. Create the syslin obj<span><br>
h1 = wfir("lp",2,[.2 0],"re",[0 0])<br>
</span><span> h2 = wfir("hp",3,[.1 0],"re",[0
0])<br>
</span> num1 = poly(h1,'z','coeff')<br>
d = ones(1,size(h1,2)+1)<br>
d(1:$-1) = 0<br>
den1 = poly(d,'z','coeff')<br>
H1 = syslin('d',num1,den1)<br>
num2 = poly(h2,'z','coeff')<br>
d = ones(1,size(h2,2)+1)<br>
d(1:$-1) = 0<br>
den2 = poly(d,'z','coeff')<br>
H2 = syslin('d',num2,den2)<br>
<br>
2. In Xcos<br>
use H1.num in the numerator block for LPF, H1.den in
the denominator for the LPF, same for the HPF.<br>
<br>
Hope this helps.<br>
<br>
rgds,<br>
CL
<div>
<div class="m_-3606187236817741134h5"><br>
<br>
On 1/4/2017 9:53 PM, Nikolay Strelkov wrote:<br>
</div>
</div>
</div>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em" type="cite">
<div>
<div class="m_-3606187236817741134h5">
<div dir="ltr">
<div>Anybody?<br>
</div>
Dear Tim, do you have any idea?<br>
<div class="gmail_extra">
<div>
<div class="m_-3606187236817741134m_3879002882047539259m_2710602294559543633gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div class="m_-3606187236817741134m_3879002882047539259m_2710602294559543633gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr"><br>
--<br>
</div>
<div><i>With best regards,<br>
<span lang="en"><span>Ph.D.,
</span></span></i><i><span lang="en"><span>associate</span>
professor at <a href="http://mpei.ru/lang/en/Pages/default.aspx" rel="nofollow" link="external" target="_blank">MPEI</a>,<br>
</span><span>IEEE
member,</span><br>
maintainer of <a href="http://atoms.scilab.org/toolboxes/Mathieu/" rel="nofollow" link="external" target="_blank">Mathieu
functions toolbox
for Scilab</a>,<br>
<span>Nikolay</span>
Strelkov.</i><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">2017-03-23 14:27
GMT+03:00 Nikolay Strelkov <span dir="ltr"><<a href="http:///user/SendEmail.jtp?type=node&node=4036111&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a>></span>:<br>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote">
<div dir="ltr">Dear all!<br>
<div><br>
</div>
<div>I'm playing with simple digital
filtering in Xcos 5.5.2.<br>
I have two filters - low-pass and
high-pass, connected in series.<br>
</div>
<div><br>
Xcos does not have convolution block.<br>
So I write <a href="https://ccrma.stanford.edu/%7Ejos/fp/FIR_Transfer_Function.html" rel="nofollow" link="external" target="_blank">FIR transfer
function</a> manually from impulse
response function.<br>
</div>
<div>I get impulse response functions
from <span style="font-family:monospace,monospace">wfir</span>
function.<br>
</div>
<div><br>
</div>
<div>Let's assume that we have two
simple filters with impulse responses:<br>
</div>
<div><span style="font-family:monospace,monospace">h1
= [0.3741957 0.3741957]; // it's
low-pass filter from h1 =
wfir("lp",2,[.2 0],"re",[0 0])<br>
</span></div>
<div>and<br>
</div>
<div><span style="font-family:monospace,monospace">h2
= [- 0.1870979 0.8 - 0.1870979];
// it's high-pass filter h2 =
wfir("hp",3,[.1 0],"re",[0 0])</span><br clear="all">
</div>
<div>
<div>
<div class="m_-3606187236817741134m_3879002882047539259m_2710602294559543633m_3639511918185835174gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr"><br>
</div>
<div>I convert them to
<a href="https://help.scilab.org/docs/5.5.2/en_US/DLR.html" rel="nofollow" link="external" target="_blank">DLR</a>
SISOs and get:<br>
</div>
<div><span style="font-family:monospace,monospace">H1(z)
= 0.3741957*z^-1 +
0.3741957*z^-2 = (
0.3741957*z +
0.3741957 ) /
(z^2);<br>
</span></div>
<div><span style="font-family:monospace,monospace">H2(z)
= -0.1870979*z^-1
+ 0.8*z^-2 -
0.1870979*z^-3 = (
-0.1870979*z^2 +
0.8*z -
0.1870979*z ) /
(z^3);<br>
</span></div>
<div>and place their
numerator and
denominator to the
corresponding DLR
blocks.<br>
</div>
<div>Model is in
attachment. It's an
illustration, not
real world example.<br>
</div>
<div><br>
I have a question.
How I can automate
the aforementioned
process
programmatically?<br>
I tried to create
numerator and
denominator with <span style="font-family:monospace,monospace">poly</span> function and as
strings, but Xcos
does not support
these types in DLR
settings.<br>
</div>
<div dir="ltr"><br>
--<br>
</div>
<div><i>With best
regards,<br>
<span lang="en"><span>Ph.D.,
</span>assistant
professor at <a href="http://mpei.ru/lang/en/Pages/default.aspx" rel="nofollow" link="external" target="_blank">MPEI</a>,<br>
</span><span>IEEE
member,</span><br>
maintainer of <a href="http://atoms.scilab.org/toolboxes/Mathieu/" rel="nofollow" link="external" target="_blank">Mathieu
functions
toolbox for
Scilab</a>,<br>
<span>Nikolay</span>
Strelkov.</i><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
<br>
<fieldset class="m_-3606187236817741134m_3879002882047539259mimeAttachmentHeader"></fieldset>
<br>
</div>
</div>
<pre>______________________________<wbr>_________________
users mailing list
<a href="http:///user/SendEmail.jtp?type=node&node=4036111&i=2" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<a class="m_-3606187236817741134m_3879002882047539259moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users" rel="nofollow" link="external" target="_blank">http://lists.scilab.org/mailma<wbr>n/listinfo/users</a>
</pre>
</blockquote>
<p>
</p>
</div>
______________________________<wbr>_________________
users mailing list
<a href="http:///user/SendEmail.jtp?type=node&node=4036111&i=3" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<a href="http://lists.scilab.org/mailman/listinfo/users" rel="nofollow" link="external" target="_blank">http://lists.scilab.org/mailma<wbr>n/listinfo/users</a>
</blockquote></div>
</div></div>
<fieldset class="m_-3606187236817741134mimeAttachmentHeader"></fieldset>
<pre>______________________________<wbr>_________________
users mailing list
<a href="http:///user/SendEmail.jtp?type=node&node=4036111&i=4" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<a class="m_-3606187236817741134moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users" rel="nofollow" link="external" target="_blank">http://lists.scilab.org/<wbr>mailman/listinfo/users</a>
</pre>
</blockquote><p>
</p><br>______________________________<wbr>_________________
<br>users mailing list
<br><a href="http:///user/SendEmail.jtp?type=node&node=4036111&i=5" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="http://lists.scilab.org/mailman/listinfo/users" rel="nofollow" link="external" target="_blank">http://lists.scilab.org/<wbr>mailman/listinfo/users</a><br>
<br>
<br>
<hr noshade size="1" color="#cccccc">
</div></div><div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif"><div><div class="h5">
<div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
</div></div><a href="http://mailinglists.scilab.org/Scilab-users-Define-numerator-and-denominator-of-transfer-function-as-variables-in-Xcos-DLR-block-tp4035961p4036111.html" target="_blank" rel="nofollow" link="external">http://mailinglists.scilab.<wbr>org/Scilab-users-Define-<wbr>numerator-and-denominator-of-<wbr>transfer-function-as-<wbr>variables-in-Xcos-DLR-block-<wbr>tp4035961p4036111.html</a>
</div><div class="HOEnZb"><div class="h5">
<div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
To start a new topic under Scilab users - Mailing Lists Archives, email <a href="/user/SendEmail.jtp?type=node&node=4036118&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a> <br>
To unsubscribe from Scilab users - Mailing Lists Archives, <a href="" target="_blank" rel="nofollow" link="external">click here</a>.<br>
<a href="http://mailinglists.scilab.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_blank" link="external">NAML</a>
</div></div></div></blockquote></div><br></div>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://mailinglists.scilab.org/Scilab-users-Define-numerator-and-denominator-of-transfer-function-as-variables-in-Xcos-DLR-block-tp4035961p4036118.html">Re: Define numerator and denominator of transfer function as variables in Xcos (DLR block)</a><br/>
Sent from the <a href="http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html">Scilab users - Mailing Lists Archives mailing list archive</a> at Nabble.com.<br/>