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