Help with a two variables equation?
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen

Hi there, Im trying to create a 3D graph of the Constant Surface Heat flux in a material. The equation is in the pic i added. The thing is, i get problems with multiplying the matrices (x and t).. What am i doing wrong? is there any one who can help write this code? Thank you! (the only variables are x and t, all others are constant.)
2 Kommentare
Star Strider
am 21 Dez. 2014
Posting your code would help significantly.
We’re good, but we can’t guess what code you’ve written.
Nir
am 21 Dez. 2014
Antworten (1)
Roger Stafford
am 22 Dez. 2014
In the line
T(x,t)=((2*q)/(k))*......
if T is to be a matrix of values, then the 'x' and 't' values must be indices which are positive integers, and that is not the case with your code. For generating a surface in 3D you should use 'meshgrid' or 'ndgrid' to create a grid of value pairs and then call on 'surf'.
[x,t] = meshgrid(0:0.01:10,0:0.01:10);
T = ((2*q)/(k))*......
surf(x,y,T)
Also I notice several discrepancies between the image of "T(x,t) = ..." equation and the equation you have coded:
1) The -Ti on the left should become +Ti on the right.
2) exp((-(x.^2))/4*alpha*t') should be exp(-x.^2./(4*alpha*t)).
3) x/(sqrt(2*alpha*t)) should be x./(2*sqrt(alpha*t)).
Also it was not necessary to convert the erfc to 1-erf, since matlab already has an erfc function.
2 Kommentare
Nir
am 22 Dez. 2014
Roger Stafford
am 22 Dez. 2014
Bearbeitet: Roger Stafford
am 22 Dez. 2014
You didn't take my and Mohammad Abouali's advice on 2):
2) exp((-(x.^2))/4*alpha*t') should be exp(-x.^2./(4*alpha*t)).
Without that added 'dot' it would give you the error message. Also you are multiplying by alpha*t here and the operation shown in your original image requires that you divide by these quantities.
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

