Help keep getting error: Error using matlab.gra​phics.char​t.primitiv​e.Surface, Value must be a vector or 2D array of numeric type

조회 수: 6 (최근 30일)
I keep getting the following error:
Error using matlab.graphics.chart.primitive.Surface
Value must be a vector or 2D array of numeric type
I'm trying to mesh my second order regression results.
Thank you for any help!
figure(7)
scatter3(x1,x2,x3,y,'filled','k');
hold on
x1fit = linspace(min(x1),max(x1),30);
x2fit = linspace(min(x2),max(x2),100);
x3fit = linspace(min(x3),max(x3),100);
[X1FIT,X2FIT,X3FIT] = meshgrid(x1fit,x2fit,x3fit);
YFIT = -2166.2 + 509.5*X1FIT - 1.8*X2FIT + 56.52*X3FIT+3.02*X1FIT.*X3FIT-37.45*(X1FIT.^2)-2.14*(X3FIT.^2);
mesh(X1FIT,X2FIT,X3FIT,YFIT)
xlabel('Substrate')
ylabel('Temp')
zlabel('Yield')
title('Multiple regression surface model')
s = surface;
c = s.CData;
s.CDataMapping = 'direct';
hold off
  댓글 수: 2
Star Strider
Star Strider 2019년 12월 19일
The problem is that ‘X!FIT’ and the rest are (30x100x100) 3D arrays.
Unfortunately, in this uinverse (with three large dimensions and time), it is only possible to represent three spatial dimensions and one time dimension. MATLAB follows that convention.
It may be possible to do what you want, however we need more details on what you calculated and what you want to plot.
Kavya Vuriti
Kavya Vuriti 2020년 3월 31일
Hi,
Could you provide more inputs on what you want to achieve. The error is because meshgrid function in the above code is giving 3D arrays as output and these cannot be used as inputs to mesh function.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Fit Postprocessing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by