Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Extract function specification' topicStudent Support Forum > General > Archives > "Extract function specification"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
yehuda
03/03/13 06:17am

Well, type needs also to be an argument of the function, otherwise it is not initialized
so change the definition to

myfun[tf_,type_] := Module[{x},
Which[type == "Lowpass",
x= do something with tf,
type == "Highpass",
x= do something with tf,
type == "Bandpass",
x= do something with tf]
];

you may also skip the assignment to x

myfun[tf_,type_] := Module[{x},
Which[type == "Lowpass",
do something with tf,
type == "Highpass",
do something with tf,
type == "Bandpass",
do something with tf]
];

BUT I wonder why you need the Which declaration at all
If you pass a single transfer function, why do you need to select the operation

all you need is something similar to

myfun[tf_]:= do something with the tf

BUT ON WHAT? just a transfer function is not sufficient. you need an input

myfun[tf_,input_]:= do something TO input using the tf

HTH

yehuda



URL: ,

Subject (listing for 'Extract function specification')
Author Date Posted
Extract function specification Tatjana 02/27/13 01:56am
Re: Extract function specification yehuda 03/03/13 06:17am
Re: Re: Extract function specification Tatjana 03/04/13 02:01am
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic