Sketching a tangent plane to the given equation

5 visualizaciones (últimos 30 días)
Keni Fernando
Keni Fernando el 14 de Abr. de 2021
Comentada: Keni Fernando el 17 de Abr. de 2021
How to plot a tangent plane to a given equation with a range.
Example question is as follows,
z=sqrt(5-x^2-y^2) in the regions [-sqrt(5/2)<=x<=sqrt(5/2)], [-sqrt(5/2)<=y<=sqrt(5/2)]
and sketch the tangent plane to Z at point [sqrt(5)/2,sqrt(5)/2,sqrt(5/2)].

Respuesta aceptada

Khalid Mahmood
Khalid Mahmood el 14 de Abr. de 2021
Lim=sqrt(5/2); inc=2*Lim/99; %100 incremets
[X,Y] = meshgrid(-Lim:inc:Lim);
ZFunc= @(x,y) real(sqrt(5-x.*x-y.*y));
Z=ZFunc(X,Y);
[fx,fy] = gradient(Z,inc); %gradient approximates derivative of Z=f(x,y) with same finite length as inc
x0 = Lim;
y0 = Lim;
comp = (X == x0) & (Y == y0);
indt = find(comp);
fx0 = fx(indt);
fy0 = fy(indt);
z0=x0;
Z_tanSurf = @(x,y) ZFunc(x0,y0) + fx0*(x-x0) + fy0*(y-y0); %tangent plane function
Zt=Z_tanSurf(X,Y);
subplot(2,2,1);surf(X,Y,Z,'EdgeAlpha',0.7,'FaceAlpha',0.9)
title('given 3D surface')
%hold on
subplot(2,2,2);surf(X,Y,Zt); title('Tagent Plane');
subplot(2,2,3);plot3(x0,y0,z0,'r*'); title('Required point');
subplot(2,2,4);surf(X,Y,Z,'EdgeAlpha',0.7,'FaceAlpha',0.9); title(['3d plot, tagent Plane to plot at given point' mat2str([x0,y0,z0])]);
hold on;surf(X,Y,Zt);plot3(x0,y0,ZFunc(x0,y0),'r*')
  3 comentarios
Isuru Prabodh Appuhamy
Isuru Prabodh Appuhamy el 15 de Abr. de 2021
how can I plot tangent plane in same graph
Keni Fernando
Keni Fernando el 17 de Abr. de 2021
how can we change the x0, y0, and z0. In ur method if i try to change those values it gives an error.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Numerical Integration and Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by