gistlib
main.m% Define the surface function f = @(x, y) x^2 + y^3; % Define the gradient of the function syms x y gradF = [diff(f(x, y), x), diff(f(x, y), y)]; % Define the x, y values in the cube space x_values = -20:1:20; y_values = -20:1:20; % Find the points where the gradient is [0, 0] tangent_plane_positions = []; for i = 1:length(x_values) for j = 1:length(y_values) grad = double(subs(gradF, [x, y], [x_values(i), y_values(j)])); if isequal(grad, [0, 0]) tangent_plane_positions = [tangent_plane_positions; x_values(i), y_values(j)]; end end end disp(tangent_plane_positions); 621 chars24 lines
% Define the surface function f = @(x, y) x^2 + y^3; % Define the gradient of the function syms x y gradF = [diff(f(x, y), x), diff(f(x, y), y)]; % Define the x, y values in the cube space x_values = -20:1:20; y_values = -20:1:20; % Find the points where the gradient is [0, 0] tangent_plane_positions = []; for i = 1:length(x_values) for j = 1:length(y_values) grad = double(subs(gradF, [x, y], [x_values(i), y_values(j)])); if isequal(grad, [0, 0]) tangent_plane_positions = [tangent_plane_positions; x_values(i), y_values(j)]; end end end disp(tangent_plane_positions);
gistlibby LogSnag