Sketching a tangent plane to the given equation

5 ビュー (過去 30 日間)
Keni Fernando
Keni Fernando 2021 年 4 月 14 日
コメント済み: Keni Fernando 2021 年 4 月 17 日
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)].
  1 件のコメント
Khalid Mahmood
Khalid Mahmood 2021 年 4 月 14 日
Hope you asked for following

サインインしてコメントする。

採用された回答

Khalid Mahmood
Khalid Mahmood 2021 年 4 月 14 日
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 件のコメント
Isuru Prabodh Appuhamy
Isuru Prabodh Appuhamy 2021 年 4 月 15 日
how can I plot tangent plane in same graph
Keni Fernando
Keni Fernando 2021 年 4 月 17 日
how can we change the x0, y0, and z0. In ur method if i try to change those values it gives an error.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by