help-octave
[Top][All Lists]

Re: Newbie question: f([1 2 3],[1 2 3])

 From: A. Scottedward Hodel Subject: Re: Newbie question: f([1 2 3],[1 2 3]) Date: Fri, 09 Apr 1999 10:19:48 -0500

```>I have a function f(x,y). This could either be a funktion that I have
>written myself or a Besselfunction besselj(x,y). In MatLab I can write:
>f([1 2 3],[1 2 3])
>
>
>This would give me a matrix that I can use to do a 3d plot
>
>[f(1,1) f(1,2) f(1,3); ........ ]
>f([1 2 3],[1 2 3])

This is incorrect unless the function f is written to do what you've
described.  For example, a matlab m-file
function val = ff(x,y)
val = log(x*y);
in matlab yields:
EDU>ff([1 2 3],[1 2 3])
??? Error using ==> *
Inner matrix dimensions must agree.

Error in ==> home4:Matlab:ff.m
On line 2  ==> val = log(x*y);

The m-file function must be written to understand what is desired in
vector-valued
arguments.

>Is there an easy solution to do the same in octave?
The m-file solutions for Matlab and Octave should be quite similar, depending
on what you're trying to do.

A S Hodel Assoc. Prof. Dept Elect Eng, Auburn Univ,AL  36849-5201
On leave at NASA Marshall Space Flight Center (256) 544-1426
Address until 15 Mar 2000:Mail Code ED-13, MSFC, Alabama, 35812
http://www.eng.auburn.edu/~scotte

```