How to change contour level in different range?

조회 수: 125 (최근 30일)
Kim Je Young
Kim Je Young 2019년 7월 15일
댓글: FNU Dhanraj 2021년 9월 1일
Hello, I am new to Matlab.
Currently, I am plotting BSFC map using contour function.
I wanna set different levelstep instead of fixed value.
Due to fixed LevelStep, the below graph looks so ugly.
For levelList<300, I would like to set levelStep=50, and for LevelList>300, I would like to set LevelStep as 5.
Is there any way to control Level Step (Isoline) in different LevelList?
FYI, here is my code.
Thank you for your help in advance.
rawdata=xlsread('BSFC_NA2.xlsx','Sheet1','A1:I88');
RPM =rawdata(:,1);
Torque = rawdata(:,2);
bsfc = rawdata(:,3);
R100 = rawdata(:,4);
T100 = rawdata(:,5);
RPM1 =rawdata(:,6);
Torque1 = rawdata(:,7);
bsfc1 = rawdata(:,8);
% Create gridded data:
Rpmgrid = linspace(1000,max(RPM),10);
Torquegrid = linspace(0,90,10);
BSFCgrid = gridfit(RPM,Torque,bsfc,Rpmgrid,Torquegrid);
[c1,h1]=contour(Rpmgrid,Torquegrid,BSFCgrid,'LevelStep',5,'ShowText','on'); drawnow
set(h1.EdgePrims(h1.LevelList>0 ), 'LineStyle', 'dotted');
hold on
k5=plot(R100,T100,'r','LineWidth',3)
hold on
untitled.jpg

채택된 답변

KSSV
KSSV 2019년 7월 15일
[X,Y,Z] = peaks(100) ;
figure
hold on
contour(X,Y,Z,'LevelList',-6:0.2:4) % levels with difference 0.2 for till 4
contour(X,Y,Z,'LevelList',4:0.5:8) % levels with difference 0.5 from 4 to 8
  댓글 수: 3
Omar Dominguez
Omar Dominguez 2021년 4월 16일
Thank you the solution is perfect!
\
FNU Dhanraj
FNU Dhanraj 2021년 9월 1일
Is there a final code that works well for BSFC Map?

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

추가 답변 (0개)

카테고리

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