MATLAB: Show equation on the 3D Plot

3d plotsmultiple regression

Greeting All
Can I get multiple regression equation in matlab code and show the equation on the 3D Plot.
I ihave three axeis X, Y , and Z.
Best regards

Best Answer

  • Hi,
    I assume the question needs two things one is getting the equation and then plotting on to the figure.
    Multilinear regression (3d plot) may be solved using code in this link.
    The below code can be added in the above link(after zlabel) to get figure title.
    caption = sprintf('y = %f + %f * x1 + %f * x2 + %f * x1*x2', b(1),b(2),b(3),b(4));
    text(15,185,45, caption, 'FontSize', 10, 'Color', 'r', 'FontWeight', 'bold');
    You may get similar type of figure like below.
    Hope this helps.