How to change contour level in different range?

120 Ansichten (letzte 30 Tage)
Kim Je Young
Kim Je Young am 15 Jul. 2019
Kommentiert: FNU Dhanraj am 1 Sep. 2021
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

Akzeptierte Antwort

KSSV
KSSV am 15 Jul. 2019
[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 Kommentare
Omar Dominguez
Omar Dominguez am 16 Apr. 2021
Thank you the solution is perfect!
\
FNU Dhanraj
FNU Dhanraj am 1 Sep. 2021
Is there a final code that works well for BSFC Map?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by