Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Aaron Erhardt
Cheatsheets
Commits
b2fe8b91
Commit
b2fe8b91
authored
May 16, 2021
by
Aaron Erhardt
Browse files
Improve 3D-plot section
Signed-off-by:
Aaron Erhardt
<
aaron.erhardt@t-online.de
>
parent
69ae1bda
Pipeline
#583
passed with stage
in 1 minute and 54 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Matlab/Matlab.md
View file @
b2fe8b91
...
...
@@ -528,13 +528,32 @@ handle.Children(1).LineWidth = 2; % get line from handle and change width
plot3
(
x
,
y
,
z
);
```
### Meshgrid
### Surfaces
Generate grid
```
matlab
% Generate grid from matrices with duplicate rows of x and duplicate columns of y
[
X
Y
]
=
meshgrid
(
x
,
y
);
% Matrices with dimension length(x) x length(y)
mesh
(
X
,
Y
)
% Plot mesh
Z
=
X
.^
2
-
Y
% use (uppercase!) X and Y to calculate Z
mesh
(
X
,
Y
,
Z
)
% Plot mesh with Z coordinate
```
Mesh surface plot
```
matlab
mesh
(
X
,
Y
)
% Plot mesh (using X and Y from meshgrid)
Z
=
X
.^
2
-
Y
% use (uppercase!) X and Y to calculate Z
mesh
(
X
,
Y
,
Z
)
% Plot mesh with Z coordinate
```
Surface plot
```
matlab
% Grids are simply specified by matrices of coordinates
[
X
Y
]
=
meshgrid
(
x
,
y
,
z
);
% Generate grid
mesh
(
X
,
Y
)
% Plot mesh
mesh
(
X
,
Y
,
Z
)
% Plot mesh with Z coordinate
surf
(
X
,
Y
,
Z
)
% Similar to mesh but always with Z coordinate
```
# Functions
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment