help-octave
[Top][All Lists]
Advanced

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

function values vector


From: mmasny
Subject: function values vector
Date: Fri, 14 May 2010 06:36:35 -0700 (PDT)

Hello, I'm a complete newbie, and after reading several tutorials still
haven't solved the following problem:
I have a vector x=linspace(0,2*pi,256). There is a function H given as
follows:

function y=H(x)
    if (x<pi)
        y=0;
    else 
        y=1;
    endif
end

Now, I want a vector Y such that each of its coordinates xi is H(xi). What's
the best way to that? Y=H(X) doesn't work (it makes Y=1, which I don't
understand). Do I need a loop to do that?
-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/function-values-vector-tp2216589p2216589.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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