Domanda

I am wondering if anyone knows (or is it possible?) how to generate a trend equation from a 3D surf plot from Matlab? I understand that we can create trendline for 2D plots (linear and nonlinear) and show its equation, but how about 3D plot? Can we create something like:

z = ax + by?

Regards Kit

È stato utile?

Soluzione

If you have the curve fitting toolbox you can fit 3D surfaces using cftool as described here.

Here's an example:

[X,Y] = meshgrid(1:100,1:100);
X = reshape(X,numel(X),1);
Y = reshape(Y,numel(Y),1);
Z = 3*X+4*Y;
plot3(X,Y,Z)

f = fit([X, Y], Z, 'poly11');
coeffvalues(f)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top