Need help plotting T(x,y,z,t) at different times?!
6 views (last 30 days)
Show older comments
Sorry, I think I accepted an answer so my thread closed. I'm new here.
I want to plot the first few terms of this triple sum I solved for (should be a good approximation) I was thinking about showing the initial temperature distribution (t=0), and then T(x,y,z,t=100000) or something to show how it disipated over time. Im not sure how to go about it. Here is the sum I have.
Ill also post the code I came up with, essentially I have a function, with 4 variables, T(x,y,z,t). I hope this is clear. Here is what I've tried. Id appreciate any help. I just want to plot that function at different values of t :(
clc; clear all; close all
k=46; %conductivity
rho=3970; %material density
cp=765; %specific heat
alpha=k/(rho*cp);
x=0:pi;
y=0:pi;
z=0:pi;
t=0:10;
T=@(x,y,z,t) (1.376*sin(x).*sin(y).*cos(0.5*z).*exp((-2.25*alpha*t))+(0.153*sin(3*x).*sin(3*y).*cos(0.5*z).*exp((-18.25*alpha*t)-(0.055*sin(5*x).*sin(5*y).*cos(0.5*z).*exp((-50.25*alpha*t))-(0.827*sin(x).*sin(y).*co(1.5*z).*exp((-4.25*alpha*t)-(0.092*sin(3*x).*sin(3*y).*cos(1.5*z).*exp((-20.25*alpha*t)-(0.33*sin(5*x).*sin(5*y).*cos(1.5*z).*exp((-52.25*alpha*t));
x=0:pi;
y=0:pi;
z=0:pi;
t=0:10;
surf(T)
0 Comments
Answers (2)
Walter Roberson
on 12 Oct 2012
[X, Y, Z] = ndgrid(x, y, z);
T0 = T(X, Y, Z, 0);
subplot(2,1,1);
surf(T0);
subplot(2,1,2);
T10000 = T(X, Y, Z, 10000);
surf(T10000);
But I suggest you double-check what the result is of
x=0:pi;
0 Comments
Jonathan
on 12 Oct 2012
3 Comments
Walter Roberson
on 12 Oct 2012
Ah, the problem is that I suggested that you surf() a 3D matrix of information, which is not possible.
How were you hoping to represent the 4D plot T(x range, y range, z range, fixed temperature) in a 2.5D graphics system ?
See Also
Categories
Find more on Matrix Indexing 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!