[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [newbie] how to make a function perform differently depending on out
From: |
Olivier Crouzet |
Subject: |
Re: [newbie] how to make a function perform differently depending on output asked for |
Date: |
Mon, 8 Dec 2014 20:41:32 +0100 |
Hi,
you may also have a look at the bode.m function source code:
/usr/share/octave/packages/control-2.6.6/bode.m (in Debian; the base
directory may vary),
which will give you insights into how the bode.m function itself is
designed (and have a look at the nargout expression). It uses
if (! nargout)
[...]
else
[...]
endif
Which will let you
Olivier.
On Mon, 8
Dec 2014 19:31:30 +0100 Jean Dubois <address@hidden> wrote:
> I'm a writing a bode-function myself as I want it to perform a bit
> differently from
> the bode-function in the octave-control package. I could make it plot
> the phase and magnitude diagrams as I wish now, but I'd also like it
> to mimic a behaviour which the bode-function in the octave-control
> package has: when you enter this:
> bode(tf([3 1],[1 3 1]))
> you get the two expected plots on you screen
> however you can also do this:
> [mag,pha,w]=bode(tf([3 1],[1 3 1]))
>
> in this case you don't get the plots on the screen but the results
> are put in the arrays mag, pha an w
>
> How can I make my own function do the same? The function should detect
> somehow whether numerical output is desired or not.
>
> any help very much appreciated
> jean
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave
--
Olivier Crouzet, PhD
Laboratoire de Linguistique -- EA3827
Université de Nantes
Chemin de la Censive du Tertre - BP 81227
44312 Nantes cedex 3
France
phone: (+33) 02 40 14 14 05 (lab.)
(+33) 02 40 14 14 36 (office)
fax: (+33) 02 40 14 13 27
e-mail: address@hidden
http://www.lling.univ-nantes.fr/