フィルターのクリア

Matlab F(x,y,z) Plotting

12 ビュー (過去 30 日間)
Ömer Faruk Çetinkaya
Ömer Faruk Çetinkaya 2020 年 5 月 16 日
移動済み: Torsten 2023 年 4 月 20 日
Greetings,
I would like to plot a function i.e. f(x,y,z) = X.^4 - 2*X.^2 + Y.^2 + 2*Y*Z +2*Z.^2 for my backtracking optimization problem. I am able to plot the contour of f(x,y) questions with the code given below. But I couldn't even plot a contour such function. Any help would be appreciated.
xAxis = linspace(-1,2.5,1000);
yAxis = linspace(-1,2.5,1000);
zAxis = linspace(-1,2.5,1000);
[ X,Y ] = meshgrid(xAxis,yAxis);
Z = X.^2 + 5*Y.^2 ;
contour(X,Y,Z,30)
Best Regards,
Ömer

回答 (2 件)

Ameer Hamza
Ameer Hamza 2020 年 5 月 16 日
編集済み: Ameer Hamza 2020 年 5 月 16 日
You can use slice() to create a contour plot of your function at specified planes. Try this
xAxis = linspace(-1,2.5,100);
yAxis = linspace(-1,2.5,100);
zAxis = linspace(-1,2.5,100);
[X, Y, Z] = meshgrid(xAxis,yAxis,zAxis);
f = X.^4 - 2*X.^2 + Y.^2 + 2*Y.*Z +2*Z.^2;
x_planes = [1 2];
y_places = 0;
z_planes = [0.5 1];
slice(X, Y, Z, f, x_planes, y_places, z_planes);

Drc
Drc 2023 年 4 月 20 日
y^2/b^2-x^2/a^2=z/c
I want this function in 3D
  1 件のコメント
Torsten
Torsten 2023 年 4 月 20 日
移動済み: Torsten 2023 年 4 月 20 日
Use "fimplicit3".

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

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by