plotting a plane in three dimensions including data points

조회 수: 296 (최근 30일)
cgo
cgo 2017년 12월 7일
답변: cui,xingxing 2022년 8월 25일
Hi,
I have a plane obtained via regression. Let's say this is z = 2x + 3y + 4. I want to plot this plane AND the data points. How do I do this?

채택된 답변

Erivelton Gualter
Erivelton Gualter 2018년 10월 22일
Run the following code:
[x y] = meshgrid(-10:1:10);
z = 2.*x + 3.*y + 4;
surf(x,y,z);
To add the data you can add the following lines:
hold on;
plot3(DataX, DataY, DataZ);
You can check the meshgrid and surf function in the following links:

추가 답변 (1개)

cui,xingxing
cui,xingxing 2022년 8월 25일

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by