Plot contour with 3 variables

조회 수: 10 (최근 30일)
Carolina Maria Clase Sousa
Carolina Maria Clase Sousa 2021년 1월 18일
댓글: Star Strider 2021년 1월 18일
Hi!
I'm running a simulation in AVL in order to make an engine performance map. For that I have the values of 1- engine speed, 2-BMEP and 3-BSFC as output. I've organized them in a 17x3 matrice. I pretend to do a contour plot with engine speed as x, BMEP as y and BSFC as z.

채택된 답변

Star Strider
Star Strider 2021년 1월 18일
The contour function requires matrices. You will need to create the matrices from your vectors.
Try this (with your actual data):
x = [7 6.5 6 5.5 5 4.8 4.5]*1E3; % Extract From Image
y = [8.06 8.65 9.20 9.55 9.71 8.66 9.57]; % Extract From Image
z = [320 300 290 284 275 272 268]; % Extract From Image
data = [x(:) y(:) z(:)];
xv = linspace(min(data(:,1)), max(data(:,1)), 20); % Interpolation Independent Variable Vector
yv = linspace(min(data(:,2)), max(data(:,2)), 20); % Interpolation Independent Variable Vector
[X,Y] = ndgrid(xv, yv); % Interpolation Independent Variable Matrices
Z = griddata(data(:,1), data(:,2), data(:,3), X, Y); % Interpolated Dependent Variable
figure
contour(X, Y, Z, 'ShowText','on')
grid on
xlabel('Engine Speed (RPM)')
ylabel('BMEP')
zlabel('BSFC')
title('Performance')
.
  댓글 수: 2
Carolina Maria Clase Sousa
Carolina Maria Clase Sousa 2021년 1월 18일
It worked realy well! Thanks
Star Strider
Star Strider 2021년 1월 18일
As always, my pleasure!

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

추가 답변 (0개)

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by