2D contour plot for 3 known variables

I currently have 4 datasets with 3 variables
SPD = [37.3;37.1;4.9;165]
K = [810;2250;1311;8000]
Level = [4;4;5;1]
I want to plot SPD and K and have a contour of Level, I will obviously have more data points eventually . Level is strictly from 1-5 so I'd ideally like a noticeable change in colour between each value.
Is this possible at all?

답변 (1개)

KSSV
KSSV 2017년 9월 1일

0 개 추천

SPD = [37.3;37.1;4.9;165] ;
K = [810;2250;1311;8000] ;
Level = [4;4;5;1] ;
[X,Y] = meshgrid(SPD,K) ;
val = repmat(Level,1,size(X,1)) ;
contour(X,Y,val)

댓글 수: 6

Joel Babbage
Joel Babbage 2017년 9월 1일
편집: Joel Babbage 2017년 9월 1일
This seems to only give me a contour of lines. The axes are what I am after but I was hoping for a 'fluid' contour around the points (SPD,K)
Joel Babbage
Joel Babbage 2017년 9월 1일
Apologies, I meant to add the screenshot originally but it didn't work. I have edited the picture in so you can see the result I'm getting.
KSSV
KSSV 2017년 9월 1일
Show us any pictorial example..
Joel Babbage
Joel Babbage 2017년 9월 1일
This is similar to what I am after where the shades from green through to pink would represent level 1 - 5
KSSV
KSSV 2017년 9월 1일
Ohh..for this you need to have x, y and level data......do you have it?
Joel Babbage
Joel Babbage 2017년 9월 1일
Yes, SPD and K represent my x and y data.

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

카테고리

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

질문:

2017년 9월 1일

댓글:

2017년 9월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by