# How to plot Efficiency maps

202 views (last 30 days)

Show older comments

I am trying to plot the efficiency map using a contour function for the torque speed curve shown below. the problem is, the contour function, plots for the whole surface of the matrix. But i only want the contour plot to be under the torque speed curve so that the part above the torque speed curve is white.

the link below is a link of the torque speed curve. any help would be much appreciated

##### 0 Comments

### Answers (3)

Junfei Tang
on 4 Feb 2016

Edited: Junfei Tang
on 4 Feb 2016

Hi,

Before creating the efficiency map, I think you already have a set of coordinates (x,y) and the corresponding values (z), i.e. the efficiencies. Then you need to put all the x-axis values together, all the y-axis values together and all the z-axis values together to form matrices:

X = [ X(1,1), X(1,2), X(1,3), ..., X(1,n);

X(2,1), X(2,2), X(2,3), ..., X(2,n);

...................................;

X(n,1), X(n,2), X(n,3), ..., X(n,n) ];

Y = [ Y(1,1), Y(1,2), Y(1,3), ..., Y(1,n);

Y(2,1), Y(2,2), Y(2,3), ..., Y(2,n);

...................................;

Y(n,1), Y(n,2), Y(n,3), ..., Y(n,n) ];

Z = [ Z(1,1), Z(1,2), Z(1,3), ..., Z(1,n);

Z(2,1), Z(2,2), Z(2,3), ..., Z(2,n);

...................................;

Z(n,1), Z(n,2), Z(n,3), ..., Z(n,n) ];

where X(x,y), Y(x,y) and Z(x,y) correspond to each other: x and y are the indices, X is the matrix containing the x-axis values, Y is the matrix containing the y-axis values and Z is the matrix containing the z-axis values, e.g. the efficiencies.

MATLAB will put the points on the map like this: MATLAB assigns Z(1,1) to be the z-axis value of point (X(1,1), Y(1,1)); then assigns Z(2,1) to be the z-axis value of point (X(2,1), Y(2,1)); ... until assigns Z(n,n) to be the z-axis value of point (X(n,n), Y(n,n)).

This is what I have done, since to form matrices is easier for me to check the values in a table format afterwards. However, I think if you create an array for each of X, Y and Z instead of creating a matrix for each of them, it should also work.

After the assignment of the values, start to create the figure:

figure

n = 100; % number of contour levels

efficiency_map = contourf(X,Y,Z);

colorbar;

xlabel('{\it\Omega}_r [rev/min]')

ylabel('{\itT}_e [N*m]')

legend

Then the efficiency map comes out:

##### 0 Comments

Walter Roberson
on 25 Jul 2012

The points that you do not want plotted, set the Z value to NaN before doing the contour plot.

##### 2 Comments

Can
on 26 May 2023

Ashu
on 28 Jun 2023

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!