I am trying to create a matlab function that graphs a particular function in 3D, however I keep getting the error undifined variable or not enough input arguments, Here is my code.
R1 = 2;R2 = 1;s1 = [-2;2];s2 = [3;-1];n1 = 2;n2 = 1;%for values of x and y between -5 and 5
landscape(-5:5, -5:5); function M = landscape(x, y) M = H1 + H2; function h1 = H1(x, y, R1, s1, n1) h1 = (1/(1+(R1/sqrt((x-s1(1))^2+(y-s1(2))^2))^n1)); end function h2 = H2(x, y, R2, s2, n2) h2 = (1/(1+(R2/sqrt((x-s2(1))^2+(y-s2(2))^2))^n2)); endsurf(M)contour(M)end%Thanks
Best Answer