help-octave
[Top][All Lists]
Advanced

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

simple question


From: John W. Eaton
Subject: simple question
Date: Sun, 28 Sep 1997 12:30:47 -0500

On 28-Sep-1997, Terrence Brannon <address@hidden> wrote:

| Why is this screwing up?
| 
| function a = apha(V)
|      n = -0.01*(V+60)
|      d = exp(-(V+60)/10) - 1
|      a = n/d
| endfunction
| 
| 
| 
| octave:1> V=linspace(10,20,100);
| octave:2> plot(V,apha(V));
| error: __plt2vv__: vector lengths must match

For a vector argument, your function returns a scalar.  I think you
really want to write

  function a = apha(V)
    n = -0.01*(V+60)
    d = exp(-(V+60)/10) - 1
    a = n ./ d                # really want element-by-element operator here?
  endfunction

jwe



reply via email to

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