help-octave
[Top][All Lists]
Advanced

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

Re: multiplying variables


From: bharat pathak
Subject: Re: multiplying variables
Date: Wed, 3 Feb 2010 10:16:58 +0530

Varrun,
 
    you need to use .* instead of just *
 
    as p is vector and log2 ( p ) is also a vector
    and when we do individual element by
    element operation one needs to put a .
    preceeding the operator.
 
rgds
bharat

Sent: Wednesday, February 03, 2010 10:03 AM
Subject: multiplying variables

Hi

I need to plot a graph of a function
H(p) = p log2 (p)

So in matlab i wrote it as
p = (0.1:0.1:1.0)
h = p * log2 (p)

But this gives the error
error: operator *: nonconformant arguments (op1 is 1x10, op2 is 1x10)
error: evaluating binary operator `*' near line 3, column 6
error: evaluating assignment _expression_ near line 3, column 3

How can i express h ?
--
Thanks & Regards
Varrun Ramani
Amrita University '10
Web: varrunr.wordpress.com


_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

reply via email to

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