简体   繁体   English

MATLAB绘图平面方程

[英]MATLAB plot plane equation

I have the following plane equation Yhat = 1.2 + 2.1*A + 3.1*B extracted from a multiple linear regression model with two continuous predictors variables A and B, and the predicted variable Yhat. 我从具有两个连续预测变量A和B以及预测变量Yhat的多元线性回归模型中提取了以下平面方程Yhat = 1.2 + 2.1*A + 3.1*B All variables are continuous and have values between 1 and 10. 所有变量都是连续的,其值在1到10之间。

How can I plot this plane equation? 如何绘制这个平面方程?

Easy. 简单。

Create A and B in the required range using meshgrid 使用meshgrid在所需范围内创建A和B

[A,B]=meshgrid(1:10,1:10);

evaluate the equation 计算方程

Yhat = 1.2 + 2.1.*A + 3.1.*B;

and use the surf function 并使用冲浪功能

surf(A,B,Yhat)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM