Search code examples
octavesurface

Octave: expecting scalar N, or 2-/4-element vector DOM-ezsurf Error


I need some kind of help about ezsurf as I understand from my research matlab fplot is equal to ezplot in octave. And I write a script

fx = @(x,y) x.*sin(y);
fy = @(x,y) -x.*cos(y);
fz = @(x,y) y;
ezsurf(fx, fy, fz,[-5 5 -5 -2],'--','EdgeColor','g')
hold on
ezsurf(fx, fy, fz,[-5 5 -5 -2],'EdgeColor','none')
hold off

if I able to run the script I expect to see this image ezsuf

However when I run the script I get this error

    error: ezsurf: expecting scalar N, or 2-/4-element vector DOM
error: called from
    __ezplot__ at line 260 column 7
    ezsurf at line 78 column 19
    file at line 4 column 1

What is the "expecting scalar N" what should I understand I how can I fix this. Thank you so much in advance


Solution

  • fx = @ (x,y)  x .*sin(y);
    fy = @ (x,y) -x .*cos(y);
    fz = @ (x,y)  y;
    
    h1 = ezsurf (fx, fy, fz, [-5, 5, -5, -2]);
    set (h1, 'edgecolor', 'g', 'linestyle', '--', 'linewidth', 0.1);
    hold on
    
    h2 = ezsurf (fx, fy, fz, [5, -5, 5, -2]);
    set (h2, 'edgecolor', 'none');
    hold off
    
    colormap (parula (256)); % assuming you have the parula colormap installed
    

    enter image description here