# Thread: Help with surface plotting experimental data (Matlab)

1. ## Help with surface plotting experimental data (Matlab)

Hi
I hope this is the correct section for this specific problem, and if it isn't I hope any moderator will be kind enough to move it to the proper one.

I need help with representing my results in a graphical manner. After a test run with an internal combution engine I have a matrix of values which I want to visualize with a surface plot. On the X-axis I want the [rpm] of the engine, on the Y-axis I want the engine load (How much strain is put on the engine crank shaft in Newtonmeters). The height of the Z-component will then symbolize the temperature in the engine.

What I have got from my measurements is a matrix with 3 columns and several hundred rows.

It is managed in the following manner.

[ 2000, 400, 250
1000, 400, 270
2000, 300, 230
1000, 300, 280...]

As you can see, the rpm is stepped down from the highest value to the lowest one. (In my matrix there are around 25 steps from 2000 to 1000.)

While stepping down the RPM, the torque load has been held at a constant value which in turn generate a measured temperature. This procedure repeats itself and forms, as mentioned above, several hundred rows.

How do I plot this in a three-dimensional manner with the commands surf or mesh? Do I have to manually insert the temperature after having created a meshgrid with the meshgrid command?

[RPM,Torque] = meshgrid(1000:2000,200:400) ? This will as you might figure, require vast amounts of time and I'm certain there are other more simple ways to create a surface out of my values.

How can I get the measured temperatures to position themselves in the correct rpm/torque position in my 3d-plot?

Any means of assistance is greatly appreciated!

Thanks
- Cali

2. I believe I have solved the problem with the "griddata"-command.

Below follows an example of the code.

clc,clf
'rpmNmmpTtemp.asc');

B = A(:,1);
C = A(:,2);
D = A(:,5);

%% Array
rpm = 500:10:2400;
torque = 0:10:2500;

[xi,yi] = meshgrid(rpm,torque);

[zi] = griddata(B,C,D,xi,yi);

%% Plotting
mesh(zi)
axis([0 max(rpm) 0 max(torque)])
xlabel(
'Engine RPM'), ylabel('Engine torque')

I know this is not a dedicated matlab forum but I figured I'd try anyway.

Thanks.