How to change contour level in different range?

119 vues (au cours des 30 derniers jours)
Kim Je Young
Kim Je Young le 15 Juil 2019
Commenté : FNU Dhanraj le 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

Réponse acceptée

KSSV
KSSV le 15 Juil 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 commentaires
Omar Dominguez
Omar Dominguez le 16 Avr 2021
Thank you the solution is perfect!
\
FNU Dhanraj
FNU Dhanraj le 1 Sep 2021
Is there a final code that works well for BSFC Map?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by