Visualize (plot) 3D array data
3 次查看(过去 30 天)
显示 更早的评论
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
2020-11-3
It looks like your zz2 is a 3D matrix. Either plot one matrix at time using surf or read about Slice.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!