[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: x^y question

**From**: |
Peter Cloetens |

**Subject**: |
Re: x^y question |

**Date**: |
Wed, 06 Dec 2006 12:14:56 +0100 |

I think Octave is right and you probably want your power operator to act
on the elements of x, not on the matrix x.
Use:
y = x.^2 + 2*x + 10 ;
On Wed, 2006-12-06 at 11:44 +0100, huub wrote:
>* Hi,*
>* *
>* I'm trying to plot a couple of simple functions like y = x^2 + 2*x + 10, *
>* but I got these errors:*
>* *
>* error: for A^b, A must be square*
>* error: evaluating binary operator `^' near line 4, column 7*
>* error: evaluating binary operator `+' near line 4, column 10*
>* error: evaluating binary operator `+' near line 4, column 14*
>* error: evaluating assignment expression near line 4, column 4*
>* error: called from `test' in file `/home/huub/test.m'*
>* *
>* When reading the online manual, I notice 2 things:*
>* - the main topic is matrices*
>* - the power-operator (^ and **) implementation needs improvement*
>* *
>* Can I plot simple functions like this using Octave? I tried in Scilab, *
>* and have no problems at all.*
>* *
>* Thank you*
>* *
>* Huub*
>* *
>* _______________________________________________*
>* Help-octave mailing list*
>* address@hidden*
>* https://www.cae.wisc.edu/mailman/listinfo/help-octave*