I have a problem in Octave.
I would like to plot a function of two variables, but the function is given as function of a vector as in the example below function summe(x). I don't want to change the form of this function, since it appears in several other functions and I would have to rewrite it everywhere. I first tried the following code and some variants:
function sum =summe(x);
sum=x(1)+x(2);
endfunction
x1=0:1:1;
[X,Y]=meshgrid(x1,x1);
Z=summe([X,Y]);
contour(X,Y,Z) # does not work
I tried several things, also introducing here a function
function sum1=summe1(x,y)
sum1= summe([x,y])
endfunction
and to plot this function, but it does not work too. Is there no possibility to avoid making a loop? Thanks