want ideas for contour, z is not a function for x,y
이전 댓글 표시
I'm begginer this.
I want draw a gragh using "contour".
I know the way of this is contour(x,y,Z) at help.
here, Z is function for x,y.
is it only this rule?
I want use this with Z is constant.
for example,
x y z
1 .2 10
2 .3 11
3 .4 12
4 .5 13
5 .6 14
as you can see, Z is not a function for x,y, constant.
Can I draw that using contour(or contourc, contourf... series of contour)?
How to ~ plz~
답변 (2개)
Walter Roberson
2015년 10월 7일
Z does not need to be related to x and y. For example,
x = sort(rand(1,10));
y = sort(rand(1,15));
z = rand(15,10);
contour(x, y, z);
댓글 수: 1
Walter Roberson
2015년 10월 7일
If the problem is that your Z is not a grid, then you need to use griddata() or scatteredinterpolant or triscatteredinterp
Yes. Just use
contour(X,Y,Z)
댓글 수: 8
Byungsoo Yoo
2015년 10월 7일
Thorsten
2015년 10월 7일
Sorry, I do not get what you want. Please provide some more details.
Byungsoo Yoo
2015년 10월 7일
Walter Roberson
2015년 10월 7일
No, Z is a variable that has shape length(y) by length(x). Z is not a function! You can assign arbitrary values to Z, like in my example where I showed how you could use rand().
x = 1 : 5;
y = 0.1 : .1 : .5;
z = [1 2 3 1 3; 4 7 1 4 8; -3 -3 -3 11 2; 0 12 5 5 5; 9 8 7 3 3]; %SEE, a CONSTANT
contour(x, y, z)
There is no requirement that z be calculated at all.
Saif Aleslam Abh
2015년 12월 12일
I was wondering if Z is Matrix 1*1. How can I draw it
Walter Roberson
2015년 12월 12일
Saif, are your x and y something larger than 1 x 1? Is your Z intended to be the same for all of the locations? Or do you only have a single point? If you only have a single point then what do you expect the contour plot to look like?
Saurabh Das
2020년 7월 2일
Walter, what if my X, Y and Z matrices are 1x900. Why can't I plot a contour for it?
카테고리
도움말 센터 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!