Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Mathematics
General TopicsResearchOperations ResearchStatisticsMathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Math
Math Software
MapleMathematicaMATLABScilabSASSPSS

Math Forum / Math Software / Scilab / July 2009



Tip: Looking for answers? Try searching our database.

New to Scilab - help plotting frequency response of H(z)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
davew - 03 Jul 2009 10:44 GMT
Hello,
I'm a complete novice with Scilab.  Would someone mind providing the
basic instructions to set up a z domain transfer function and perform
a simple frequency response plot?

e.g. given the following complex poles and zeros in the z domain:
pole1, pole2, zero1, zero2

H(z) = (z - zero1)(z - zero2) / ( (z - pole1)(z - pole2) )

then plot |H| (w)

Any help would be greatfully received.
davew - 03 Jul 2009 12:06 GMT
OK, I've managed to do it!

z=poly(0,'z'); //Defines z to be a polynomial variable

sys=syslin('d',<H(z)>);

fmin=0.001;
fmax=0.5;

scf(1);clf;

bode(sys,fmin,fmax); //Plots frequency response in Bode diagram
davew - 03 Jul 2009 13:57 GMT
The only problem I have now is that if I define the system to have
complex conjugate poles and zeros (so they should cancel out to
provide a real function), plot won't work.  It says it expects a real
matrix.  Is there a way around this other than multiplying out the
function and removing the complex terms ?
Tim Wescott - 04 Jul 2009 07:31 GMT
> The only problem I have now is that if I define the system to have
> complex conjugate poles and zeros (so they should cancel out to provide
> a real function), plot won't work.  It says it expects a real matrix.
> Is there a way around this other than multiplying out the function and
> removing the complex terms ?

Try this:

real((%z - 0.9 + %i * 0.1) * (%z - 0.9 - %i * 0.1));

Scilab 'marks' a variable as complex, and this gets preserved sometimes
even if the imaginary part is zero -- taking the real part marks the
result as -- well -- real.

Signature

http://www.wescottdesign.com

davew - 04 Jul 2009 11:13 GMT
> > The only problem I have now is that if I define the system to have
> > complex conjugate poles and zeros (so they should cancel out to provide
[quoted text clipped - 11 lines]
>
> --http://www.wescottdesign.com

Thanks for that.
Tim Wescott - 04 Jul 2009 07:27 GMT
> OK, I've managed to do it!
>
[quoted text clipped - 8 lines]
>
> bode(sys,fmin,fmax); //Plots frequency response in Bode diagram

%z is predefined.  Please quote the original message, even if it's you.

Signature

http://www.wescottdesign.com

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.