MATLAB function to make 3D plot

25 ビュー (過去 30 日間)
John
John 2023 年 8 月 28 日
回答済み: Riya 2023 年 8 月 31 日
Please, what MATLAB function can I use to make this 3D plot.
Reference: Local Fractional Laplace Variational Iteration Method for Solving Linear Partial Differential Equations with Local Fractional Derivative
  1 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 8 月 28 日
Try surf

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

回答 (1 件)

Riya
Riya 2023 年 8 月 31 日
Hello John
As per my understanding, you want to make a 3D plot similar to the one you attached.
Please know that in this case, you may use the “surf” function in MATLAB. The "surf function is generally used to create 3D surface plots. It visualizes a matrix or grid of heights as a surface with different colors to represent the height values.
Following is the basic syntax for using the "surf" function:
surf(X, Y, Z)
Here, ‘X and Y are matrices or vectors representing the x and y coordinates of the points in the grid.
Z is a matrix representing the corresponding height values at each (x, y) coordinate.
Below is a sample code that demonstrates how to create a simple surface plot using the surf function:
% Create x and y coordinates
x = linspace(-5, 5, 100);
y = linspace(-5, 5, 100);
[X, Y] = meshgrid(x, y);
% Define the height function
Z = sin(sqrt(X.^2 + Y.^2)) ./ (sqrt(X.^2 + Y.^2));
% Create the surface plot
surf(X, Y, Z)
In this example, X and Y; are created using the meshgrid function to define the coordinates of the points in the grid. Z is defined as a height function based on the x and y coordinates. Finally, the surf function is used to create the surface plot.
You can also customize the appearance of the surface plot by specifying additional parameters, such as colormap, shading, lighting, and more.
Please refer the following MathWorks Documentation for more details on the various options available with the surf function:
https://in.mathworks.com/help/matlab/ref/surf.html
I hope this helps!

カテゴリ

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