Surface Plot of Data with multiple Channels

48 views (last 30 days)
Anthony on 21 Jul 2015
Answered: Madhav Rajan on 23 Jul 2015
Hi all,
I want to plot a set of data that has multiple channels. Each channel represents an energy level ( a constant number so Energy1 would be a [nx1] matrix of a given energy). The way the data is set up is [Time, Energy1, Energy2,....,Intensity1, Intensity2,....]. The surface plot needs to be set up with Time on the X-axis, Energy on the Y-axis, and Intensity as the color. I have tried reading through people's approached on this but have been left very confused on how to get contourf to work for this purpose.
Thank you,
  1 Comment
Anthony on 21 Jul 2015
trying to use Delaunay in order to create triangulation for each energy level will not work since they are collinear, for example, delaunay(Time,Energy1) would give an error of collinear

Sign in to comment.

Answers (1)

Madhav Rajan
Madhav Rajan on 23 Jul 2015
I understand that you want to set up a surface plot with the time on the x-axis, energy on the y-axis and the z-axis with the intensity.
Assuming that there are n timesteps and each energy channel is an nx1 matrix of a given energy and each intensity is an nx1 matrix corresponding to the intensity for that energy channel, you could plot them using the surface plot . A different color for each channel would help you distinguish one channel from another.
You can refer the following examples which uses ten timesteps represented by 'time'. There are two energy channels 'energychannel1' and 'energychannel2' for the ten timesteps and there are two intensities matrices 'intensity1' and 'intensity2' for the corresponding energy channels that contain sample intensity values for that channel and at each timestep. The example creates a matrices of 'time' and 'energy channel' which replicates the 'time' n times denoted by 'timerep' and each energy channel matrix n times say 'energyrep1' for energy channel 1. For each energy channel, there is a call to the "surf" function that plots the surface with the x axis being the time steps, the y axis being the energy channel and the z axis being the intensity for that channel and a color value to distinguish each channel in the figure.
% Dummy Data
energychannel1 = 1:1:10;
energychannel2 = 11:1:20;
energychannel1 = energychannel1';
energychannel2 = energychannel2';
timerep = repmat(time, n, 1);
energyrep1 = repmat(energychannel1, 1, n);
energyrep2 = repmat(energychannel2, 1, n);
intensity1 = rand(n);
intensity2 = rand(n) + 10;
% Plot
hold on;
hold off;
view(30, 30);
You can refer the documentation of "repmat" from the following link:
Hope this helps.

Community Treasure Hunt

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

Start Hunting!