help-octave
[Top][All Lists]
Advanced

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

Re: How to print this function?


From: Max Brister
Subject: Re: How to print this function?
Date: Tue, 22 May 2012 11:11:07 -0600

On Tue, May 22, 2012 at 10:58 AM, lib1 <address@hidden> wrote:
> Hi,
>
> This is a beginner question, but can't seem to figure this out.
>
> Please consider:
>
>  t = [-1:0.1:1;]
>
> f = ( 1 + t ) / ( 1 - t);
>
> plot (t, f);
>
>
> I'd like to see the behavior of f function regarding t values, but all I get
> is some point.
> How should I do this?

By default octave does matrix math. So, (1 + t) /  (1 - t) does matrix
division resulting in a single scalar value. It looks like you really
want to do element-wise division, this is achieved through adding a
dot in front of the division operator like:
f = (1 + t) ./ (1 - t);

Max Brister


reply via email to

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