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
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

If the problem is that your Z is not a grid, then you need to use griddata() or scatteredinterpolant or triscatteredinterp

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

Thorsten
Thorsten 2015년 10월 7일
편집: Thorsten 2015년 10월 7일
Yes. Just use
contour(X,Y,Z)

댓글 수: 8

I want contour style. isn't anyone?
Sorry, I do not get what you want. Please provide some more details.
Z is function at contour(x,y,z)
If z type is constant, don't use the graph of contour type ?
I denote, use contour code(contour,contourc,contourf ...) with constant Z for drawing contour type graph.
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.
I was wondering if Z is Matrix 1*1. How can I draw it
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?
Walter, what if my X, Y and Z matrices are 1x900. Why can't I plot a contour for it?

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

카테고리

도움말 센터File Exchange에서 Contour Plots에 대해 자세히 알아보기

질문:

2015년 10월 7일

댓글:

2020년 7월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by