Contour Plot with specific data sets

조회 수: 5 (최근 30일)
Md Sazzadul Ahsan
Md Sazzadul Ahsan 2023년 7월 24일
댓글: Md Sazzadul Ahsan 2023년 7월 28일
I have some data of the following sort..
i need to plot a contour diagram with Class as X axis, time as Y axis, and score will be Z.
how to do that.
I am facing problems as Z is not a function of class and time, rather independent value from observations, how to set that up?
  댓글 수: 1
Dyuman Joshi
Dyuman Joshi 2023년 7월 24일
So you have 4 sets of data for Z and you want to plot them? All of them in a single figure or in different figures?
Also, what have you tried yet? How is the data stored?

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

답변 (1개)

Cris LaPierre
Cris LaPierre 2023년 7월 24일
Your Z data needs to be a matrix. X corresponds to columns, Y corresponds to rows. See here
For your data, I think you could do the following. Note that if Z is not somehow related to X and Y, your contour plot will be a bit incoherent.
class = [100,150,200,250];
Time = 1:29;
Score100 = rand(length(Time),1);
Score150 = rand(length(Time),1);
Score200 = rand(length(Time),1);
Score250 = rand(length(Time),1);
contour(class,Time,[Score100,Score150,Score200,Score250])
  댓글 수: 1
Md Sazzadul Ahsan
Md Sazzadul Ahsan 2023년 7월 28일
Yes, Thank you. I have created a Matrix of Z consisting all the different value is corresponding column. Apparantly I didn´t quite realize that meshgrid returns matrices and all.. :v
But yeah, it is working , thanks.

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

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by