![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/533709/image.jpeg)
Three variables (two independent) 3D plotting
조회 수: 1 (최근 30일)
이전 댓글 표시
I want to plot B, L, and R mutually at the same time (using both 'for' loop).
clear all
clc
R=[];
for B=-20:20;
M=1;
X=M+B;l
T=[];
for L=-10:10;
N=2;
Y=N+X;
r=B+Y+L^2;
T=[T r];
end
R=[R T];
end
댓글 수: 0
채택된 답변
dpb
2021년 2월 27일
M=1;
N=2;
flg=true;
for B=-20:20;
X=M+B;l
T=[];
for L=-10:10;
Y=N+X;
r=B+Y+L^2;
scatter3(B,L,r,'*')
if flg, flg=~flg; hold on, end
end
end
results in
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/533709/image.jpeg)
More efficient would be and left as "exercise for student" is to vectorize and use meshgrid or internal array expansion.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!