Help keep getting error: Error using matlab.graphics.chart.primitive.Surface, Value must be a vector or 2D array of numeric type
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Star Strider
le 19 Déc 2019
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
le 31 Mar 2020
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.
Réponses (0)
Voir également
Catégories
En savoir plus sur Fit Postprocessing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!