How do I plot a 3D surface where I have arrays x and y of same length and z values for each x and y value.
5 ビュー (過去 30 日間)
古いコメントを表示
So my code looks like the following
for n = 1:640; %number of time steps
for q = 1:640; %number of axial increments on a tool
Find a certain force f(q) = ...; % find force for each q increment
K = 100
z(n,q) = f(q)/K;
end
end
Now at the end I want to generate a surface where there is a z value for every q and every n combination. So z is a (n x q) size matrix. So I want 640 time steps as x. 640 axial increments as y, and a z value for each x and y combination. So the z matrix has 640*640 size
0 件のコメント
回答 (1 件)
Cris LaPierre
2018 年 12 月 7 日
5 件のコメント
Cris LaPierre
2018 年 12 月 8 日
編集済み: Cris LaPierre
2018 年 12 月 8 日
The hypothetical code is creating variables with the correct size. What is the size of the variables created in your actual code? Put a breakpoint in at the surf command and see what the actual size of n, q and z are.
And to clarify, the documentation does not say that X, Y, and Z have to be matrices. X and Y can be matrices or vectors. Z in the only one that has to be a matrix. As a simple example, see below:
n=1:40;
q=1:60;
z = n'*q;
surf(n,q,z')

参考
カテゴリ
Help Center および File Exchange で Graphics Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!