Discretize the 3-D surface into individual points in MATLAB

8 ビュー (過去 30 日間)
LM
LM 2022 年 1 月 16 日
編集済み: LM 2022 年 1 月 22 日
Hey guys!
how to discretize the 3-D surface into individual points in MATLAB.
For example, if I have a surface in x,y,z. I want to generate each curve (y,z) for x=-1,-0.9,-0.8 etc. Can you guys please give me some guidances for it, I would very appreciate it!

回答 (2 件)

KSSV
KSSV 2022 年 1 月 16 日
Read about slice. This is your function.

Walter Roberson
Walter Roberson 2022 年 1 月 16 日
F = @(X, Y) sin(X).^2 - cos(3*Y).^2; %equation of the surface
xvec = -1:0.1:1;
yvec = -3.2:.1:3.2;
[x, y] = meshgrid(xvec, yvec);
z = F(x, y);
surf(x, y, z); xlabel('x'); ylabel('y'); zlabel('z')
z is your discretized data.
  7 件のコメント
Walter Roberson
Walter Roberson 2022 年 1 月 16 日
Nx = 100;
Ny = 22;
xvec = linspace(min(xdata), max(xdata), Nx);
yvec = linspace(min(ydata), max(ydata), Ny);
[XQ, YQ] = meshgrid(xvec, yvec);
ZQ = reshape( fitresult([XQ(:), YQ(:)]), size(XQ) );
scatter3(XQ, YQ, ZQ, 'bo');
LM
LM 2022 年 1 月 16 日
Great thanks, Walter! Will give a try! Again, thank you so much!
Mao

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

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by