want ideas for contour, z is not a function for x,y

2 views (last 30 days)
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~

Answers (2)

Walter Roberson
Walter Roberson on 7 Oct 2015
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 Comment
Walter Roberson
Walter Roberson on 7 Oct 2015
If the problem is that your Z is not a grid, then you need to use griddata() or scatteredinterpolant or triscatteredinterp

Sign in to comment.


Thorsten
Thorsten on 7 Oct 2015
Edited: Thorsten on 7 Oct 2015
Yes. Just use
contour(X,Y,Z)
  8 Comments
Saurabh Das
Saurabh Das on 2 Jul 2020
Walter, what if my X, Y and Z matrices are 1x900. Why can't I plot a contour for it?

Sign in to comment.

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!