Is it possible to plot a function T(x,y,z,t), or even just T(x,y,z)?

5 views (last 30 days)
want to plot a function T(x,y,z,t) for a x=0:pi, y=0:pi, z=0:pi, and some t=0:... Is this possible? Im trying to show heat heat dissipation in a 3D cube over time.

Accepted Answer

Matt Kindig
Matt Kindig on 11 Oct 2012
Sure, the easiest way is to represent the T value using color, using scatter3 (for discrete data), or patch/surf (for continuous data, like a function). You can further use transparency to show a fifth dimension (by modifying the 'AlphaData' property of the points), although this might be too difficult to read.
doc scatter3
doc surf
  1 Comment
Jonathan
Jonathan on 11 Oct 2012
Ok, I'm very "new" to matlab (Used it as the basis for a numerical class).
This is what I came up with before getting lots of errors :(.
clc; clear all; close all
k=46; %conductivity
rho=3970; %material density
cp=765; %specific heat
x=0:pi; y=0:pi; z=0:pi; t=0:10;
T=@(x,y,z,t) (128/(pi^3)*sin(x).*sin(y).*cos(0.5*z).*exp((-2.25*k*t)/(rho*cp))-(128/(45*pi^3)*sin(3*x).*sin(3*y).*cos(1.5*z).*exp((-20.25*k*t)/(rho*cp))-(128/(525*pi^3)*sin(5*x).*sin(5*y).*cos(2.5*z).*exp((-56.25*k*t)/(rho*cp))-(128/(2205*pi^3)*sin(7*x).*sin(7*y).*cos(3.5*z).*exp((-110.25*k*t)/(rho*cp))))));
plot(x,y,z,t,T);
So you're saying using patch/surf for this? The long T function you see there is the first four terms of an infinite sum, but it should be a good approximation of the temperature distribution. Like, I said, I'm newer to matlab, and I looked online for help but couldnt get anything to work :(. Thanks!

Sign in to comment.

More Answers (0)

Categories

Find more on Live Scripts and Functions in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!