Help with a two variables equation?
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示

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 件のコメント
Star Strider
2014 年 12 月 21 日
Posting your code would help significantly.
We’re good, but we can’t guess what code you’ve written.
Nir
2014 年 12 月 21 日
回答 (1 件)
Roger Stafford
2014 年 12 月 22 日
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 件のコメント
Nir
2014 年 12 月 22 日
Roger Stafford
2014 年 12 月 22 日
編集済み: Roger Stafford
2014 年 12 月 22 日
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.
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

