Hi everyone! I want to make a nice colour graph with my data but I don't know exactly what I'm looking for. So in my experiment, I measured the excess pore pressure in 12 different positions in a deposit of sand (40x40cm side view). I have an example of the results I have for the transducers 9, 10, 11 and 12 (Fig.1). What I want is an easy way to visualise this changes in pressure in all transducers at once through time. For example, a square 40x40cm and the changes in colour (pressure) for each transducer area for the first 2 minutes (Fig.2). I know the exact position of each transducer: 12cm between them and 2cm from the top/bottom. Basically I want 2min "video" to see which part of the sand deposit is contracting or dilating during the experiment. I'm new in MatLab. I only know the basic codes to analyse my data. But now I have other ideas to present this data. Can you help me please? Thanks! Joana
MATLAB: Color-coding a 2D plot
2d colour plot
Related Solutions
Use the profiler to find the bottleneck of the code. It is not worth to improve a part, which takes 1% of the runtime, because an (impossible) infinite acceleration would reduce the runtime by 1% only.
Move repeated operations out of the loop, e.g.:
h = linspace(103.6,104,30);y = linspace(1.5,1.25,30); [X,Y] = meshgrid(h,y);
Replace the loops of i and j by:
V = zeros(30, 30);for iC = 1:900 if ~isempty(cellArray{i,j}) V(iC) = cellArray{i,j}(k); endend
But the main problem is (most likely - I cannot run your code) that a huge bunch of SURF objects is created. Prefer to create one object only and adjust its values. Define "hSurf = []" before the loops. Then:
% Replace:
% surf(Xq,Yq,Vq); % plots interpolated data
% By:
if isempty(hSurf) hSurf = surf(Xq,Yq,Vq); % plots interpolated data
else set(hSirf, 'XData', Xq, 'YData', Yq, 'ZData', Vq);end
Matlab's 1D interpolation is really lame. I don't know if this matters interp2 also. But if it does, think of replacing it by a handmade function. X,Y,Xq and Vq are constant in your problem. This should be useful for creating a faster version.
For more details it would be useful if you provide input data. It is hard to guess, where improvements of the code are useful, without running the code. It is like repairing a car without starting the engine.
I found it. This how I did the attached image:
figure quantum=max(nfe)/8; isovalue=6*quantum; surf1=isosurface(x,y,z,normalized_Free_Energy_map,isovalue); p1 = patch(surf1); isonormals(x,y,z,normalized_Free_Energy_map,p1); set(p1,'FaceColor','red','EdgeColor','none','FaceAlpha',0.1); % set the color, mesh and transparency level of the surface
daspect([1,1,1]) view(3); axis tight camlight; lighting gouraud isovalue=4*quantum; surf2=isosurface(x,y,z,normalized_Free_Energy_map,isovalue); p2 = patch(surf2); isonormals(x,y,z,normalized_Free_Energy_map,p2); set(p2,'FaceColor','yellow','EdgeColor','none','FaceAlpha',0.2); isovalue=2*quantum; surf3=isosurface(x,y,z,normalized_Free_Energy_map,isovalue); p3 = patch(surf3); isonormals(x,y,z,normalized_Free_Energy_map,p3); set(p3,'FaceColor','cyan','EdgeColor','none','FaceAlpha',0.3); isovalue=quantum; surf4=isosurface(x,y,z,normalized_Free_Energy_map,isovalue); p4 = patch(surf4); isonormals(x,y,z,normalized_Free_Energy_map,p4); set(p4,'FaceColor','blue','EdgeColor','none','FaceAlpha',1);
Best Answer