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: Joe Koski
Subject: Re: Built-in Function arguments (step)
Date: Fri, 11 Nov 2005 10:09:16 -0700
User-agent: Microsoft-Entourage/11.2.1.051004

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
-------------------------------------------------------------



reply via email to

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