Visualize (plot) 3D array data

조회 수: 5 (최근 30일)
HN
HN 2020년 11월 3일
댓글: HN 2020년 11월 3일
Surf and mesh functions are not handling the following data. Is it me or other methods should be used ? Thanks
ts=5;
t=0:1/ts:1;
x1U=0.35; % in m
x1L=0.20; % in m
x2U = deg2rad(150);
x2L = deg2rad(120);
x3U = deg2rad(-150);
x3L = deg2rad(-120);
x1=x1L:(x1U-x1L)/ts:x1U;
x2=x2L:(x2U-x2L)/ts:x2U;
x3=x3L:(x3U-x3L)/ts:x3U;
[xx1,xx2,xx3] = meshgrid(x1,x2,x3);
zz1 = 0*xx2;
zz2 = 0*xx2;
zz3 = 0*xx3;
for idx = 1:length(x1)
for jdx = 1:length(x2)
for kdx =1:length(x3)
xijk = [x1(idx) ;x2(jdx);x3(kdx);t(kdx)];
out = PRSopt_QN1(xijk);
zz1(idx,jdx,kdx) = out(1);
zz2(idx,jdx,kdx) = out(2);
zz3(idx,jdx,kdx) = out(3);
end
end
end
figure ()
mesh(xx1,xx2,zz1)
hold on
surf(xx1,xx2,zz2)
  댓글 수: 2
KSSV
KSSV 2020년 11월 3일
It looks like your zz2 is a 3D matrix. Either plot one matrix at time using surf or read about Slice.
HN
HN 2020년 11월 3일
Thank you KSSV

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by