help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Built-in Function arguments (step)


From: Hall, Benjamin
Subject: RE: Built-in Function arguments (step)
Date: Fri, 11 Nov 2005 12:22:20 -0500

I'm not sure I fully understand either, but you might be able to help
yourself by looking at the function to see what it does.  If you type

which step

at the octave prompt it will tell you where to find the function.  If you
poke around, you'll see it calls __stepimp__ which defines inp=1 if you
don't supply it.

As it is currently implemented, it doesn't look like you can skip "middle"
input arguments, so your options are to just manually supply the 1, or you
could rewrite the functions to behave more like you like (or better yet,
create a wrapper function that generates the skipped arguments).  


-----Original Message-----
From: Joe Koski [mailto:address@hidden
Sent: Friday, November 11, 2005 12:09 PM
To: Larry Blodgett; Octave Help
Subject: Re: Built-in Function arguments (step)


Larry,

I don't totally understand your question, but here are a couple of extra
ideas that may help you solve your problem.

Normally values are passed back to the calling function on the left side of
equal signs, but there is a second way, global, of passing variables among
functions in a manner similar to common blocks in Fortran. For example, if
global a; is is both the calling function and the called function, the value
of a is shared between the functions.

Second, you can check to see if a variable has already been defined with the
isempty function. Example:

% set default font type
if(isempty(fontname)==1)
   fontname ="'ArialMT'";
end

With these constructs, you can control where variables are defined and used.

You can "help isempty", or such, at the octave prompt for more information
on any function. For me, when I was learning octave, I found the paper copy
of the Octave manual (inexpensive and available at Amazon.com and other
places) very useful, while I was puzzling my way through my first attempts.

Joe

on 11/10/05 10:09 PM, Larry Blodgett at address@hidden wrote:

> How do I handle arguments in octave?
> 
> For example:
> m=20;
> 
> K=2;
> 
> D=4;
> 
> num=[1];
> 
> denum=[m,D,K];
> 
> mfdsys=tf2sys(num,denum)
> 
> step(mfdsys) automatically supplies the other arguments and plots the
> function
> 
> Here is the more general call with all the arguments
> Function File: [y, t] = step (sys, inp, tstop, n)
> Step response for a linear system. The system can be discrete or
> multivariable (or both). If no output arguments are specified, step
> produces a plot or the step response data for system sys.
> 
> Inputs
> 
> sys   System data structure.
> inp   Index of input being excited
> tstop   The argument tstop (scalar value) denotes the time when the
> simulation should end.
> n        the number of data values.
> 
> Here is the question.
> What if I want to set ONLY tstop or n and use inp as internally
> generated?
> Also, how would I specify inp, what does it actually mean?
> 
> Larry
> 
> 
> 
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
> 
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
> 




-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]