How to use multisurf to plot 3 surfaces on one plot

조회 수: 15 (최근 30일)
Liz Tuck
Liz Tuck 2018년 1월 22일
댓글: Liz Tuck 2018년 1월 22일
Hi there, I am new to matlab and am trying to use the multisurf tool to plot 3 surfaces on one plot. I have been using the code below but keep getting the error messages -
Error using matlab.graphics.chart.primitive.Surface/set Invalid parameter/value pair arguments.
Error in matlab.graphics.chart.internal.ctorHelper (line 8) set(obj, pvpairs{:});
Error in matlab.graphics.chart.primitive.Surface
Error in surf (line 139) hh = matlab.graphics.chart.primitive.Surface(allargs{:});
Error in multisurf (line 46) h(i) = surf(x{i},y{i},z{i});
Code used:
filename = 'b1_b4_sqr_clp.txt'; delimiterIn = ' '; headerlinesIn = 6; A = importdata(filename,delimiterIn,headerlinesIn);
filename = 'b1_af_sqr_clp.txt'; delimiterIn = ' '; headerlinesIn = 6; B = importdata(filename,delimiterIn,headerlinesIn);
filename = 'b2_af_sqr_clp.txt'; delimiterIn = ' '; headerlinesIn = 6; C = importdata(filename,delimiterIn,headerlinesIn);
[xs,ys] = meshgrid(0:0.001:5.799);
A = num2cell(A.data); B = num2cell(B.data); C = num2cell(C.data);
x = {xs xs xs}; y = {ys ys ys}; z = {A B C}; color = {'r','g','b'}; multisurf(x,y,z,color)
Any help would be appreciated. Thank you!

채택된 답변

Walter Roberson
Walter Roberson 2018년 1월 22일
Do not use num2cell on the data you are bundling. Just A = A.data and so on.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by