How to plot a 3D plot from three linear vectors?
조회 수: 23 (최근 30일)
이전 댓글 표시
I have three vectors x ,y and z. The size of all of them are same.But all of them are 1D arrays. I want to draw a 3D plot from them. Let me give it in code form as below:
x=linspace(0,180,100);% 1st vector
y=x;% 2nd vector
z=rand(1,100)*1e-7;% 3rd vector
I tried to convert both x and y to 2D vectors as below:
[x,y]=meshgrid(x,y);
But when I use the surface command or mesh command, it gives me error as:
Z must be a matrix, not a scalar or vector.
What to do?
댓글 수: 0
채택된 답변
Matt J
2022년 2월 21일
편집: Matt J
2022년 2월 21일
x=linspace(0,180,100);% 1st vector
y=x;% 2nd vector
z=rand(1,100)*1e-7;% 3rd vector
line(x,y,z); view(3)
댓글 수: 2
Matt J
2022년 2월 21일
The 2nd problem is a little bit different from above.
If your first problem has been solved, please Accept-click the answer. If you have a new problem, please post it in a separate thread.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!