Help with MATLAB?

Associate
Joined
22 May 2011
Posts
1,462
Location
All over the place
I am plotting slices of a block with dimensions x,y,z and using a colour map to represent the temperature of the block, which is described by the 3D-matrix, V, which is the temperature at each data point. The temperature changes over time so I am trying to create an animation using a for loop over time and drawnow.

The problem I have is that I cannot seem to access and change V. I need to implement something to effect of:

Code:
[X, Y, Z] = meshgrid([0 x], [0 y], [0 z])
h = slice(X,Y,Z,V,xslice,yslice,zslice)
colorbar

       for n = 1:tmax
            Vnew = (function that determines the temperature at the next time step)
            set(h, V, Vnew)
            drawnow
        end


I then get an error that says "There is no V property on the Surface class."

A workaround I have is to re-plot the whole graph at each step but this is very inefficient and slow - any help would be hugely appreciated!
 
Ah yes I see. This does update it, although it will only accept a 2-D matrix and applies this to each individual slice rather than making it appearing as the temperature is flowing through the whole solid:confused:

EDIT: I have a solution! I'm now creating a matrix for each face and applying it to each surface individually - it's not particularly elegant but it's much faster than re plotting the whole thing each time. Thank you so much for your help!
 
Last edited:
Back
Top Bottom