Surface under the curve

조회 수: 2 (최근 30일)
Mahi Nazir
Mahi Nazir 2015년 3월 23일
댓글: Star Strider 2015년 3월 24일
I have 3 vectors x,y,z such that function plot3 plots the attached graph. I need to fit a surface such that I get somewhat second attached graph.
I have tried surf function but I don't get the results I want. Kindly help

채택된 답변

Star Strider
Star Strider 2015년 3월 23일
This looks something like what you want:
x = [0:10 10];
y = [0:10 10];
z= [0 6 5 8 7 7 8 9 7 5 6 0];
figure(1)
patch(x, y, z, 'g')
grid on
view([-30 30])
The key is using the patch function.
producing:
  댓글 수: 2
Mahi Nazir
Mahi Nazir 2015년 3월 24일
Thanks star. Thats what i wanted... cheers!
Star Strider
Star Strider 2015년 3월 24일
My pleasure! Cheers!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Konstantinos Sofos
Konstantinos Sofos 2015년 3월 23일
griddata is the key function
Regards
  댓글 수: 2
Mahi Nazir
Mahi Nazir 2015년 3월 23일
Hi Thanks for your reply.
For example I choose
x=1:10
y=1:10
z= [6 5 8 7 7 8 9 7 5 6]
I cant see this working here. Can you please help.
Konstantinos Sofos
Konstantinos Sofos 2015년 3월 23일
편집: Konstantinos Sofos 2015년 3월 23일
Hi,
Your x,y are identical, so your data are collinear. It doesn't make sense and this is not a 3D problem but a 2D
"In statistics, multicollinearity (also collinearity) is a phenomenon in which two or more predictor variables in a multiple regression model are highly correlated, meaning that one can be linearly predicted from the others with a non-trivial degree of accuracy."

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by