You are asked to create a function to evaluate the value at each point pair individually rather than use the peaks() function and evaluate the whole input directly.
Define a function handle using the formula given and store the result in another variable in every iteration of the nested loop. Your code will look like this -
x=linspace(-3,3,10);
y=linspace(-3,3,10);
[X,Y]= meshgrid(x,y);
%What is the use of ct?
ct=-3
%Define the function, I am leaving it to you.
fun = @(x,y) ...;
%pre-allocate output variable
Z = zeros(size(X));
for i=1:length(X)
for j=1:length(Y)
Z(i,j) = fun(X(i),Y(j))
end
end
figure(1)
hold on
grid on
surf(X,Y,Z)
figure(2)
hold on
grid on
contour(X,Y,Z)