How to plot temperatures at nine different points of 2D grid resulting from Finite Difference method?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
</matlabcentral/answers/uploaded_files/47655/2D.HeatEqGridImage.png> I need to plot temperature at 9 points of the grid i.e. T11,T12,T13,T21,T22,T23,T31,T32,T33 So basically temp. vs position in the grid for an appropriately sized grid, let's say 8cmX8cm Results are T11=49.99,T12=71.42,T13=85.71,T21=28.57,T22=49.99,T23=71.427,T31=14.28,T32=28.569,T33=49.99 The code for 2D Heat Eq for steady state HT using Guass Seidel method is: (* Pl. excuse me for not including comments in the code)
clear;clc;format('long','g'); i=1; T12(i)=0;T21(i)=0; T13(i)=0;T22(i)=0; T23(i)=0; T31(i)=0; T32(i)=0; T33(i)=0; error_T11(i)=9999; while error_T11(i)>=0.01 T11(i+1)=(100+T12(i)+T21(i))/4; T12(i+1)=(100+T11(i+1)+T13(i)+T22(i))/4; T13(i+1)=(200+T12(i+1)+T23(i))/4; T21(i+1)=(0+T11(i+1)+T31(i)+T22(i))/4; T22(i+1)=(0+T21(i+1)+T23(i)+T12(i+1)+T32(i))/4; T23(i+1)=(100+T13(i+1)+T22(i+1)+T33(i))/4; T31(i+1)=(0+T21(i+1)+T32(i))/4; T32(i+1)=(0+T31(i+1)+T22(i+1)+T33(i))/4; T33(i+1)=(100+T23(i+1)+T32(i+1))/4;
error_T11(i+1)=abs(T11(i+1)-T11(i))/T11(i+1)*100;
error_T12(i+1)=abs(T12(i+1)-T12(i))/T12(i+1)*100;
error_T13(i+1)=abs(T13(i+1)-T13(i))/T13(i+1)*100;
error_T21(i+1)=abs(T21(i+1)-T21(i))/T21(i+1)*100;
error_T22(i+1)=abs(T22(i+1)-T22(i))/T22(i+1)*100;
error_T23(i+1)=abs(T23(i+1)-T23(i))/T23(i+1)*100;
error_T31(i+1)=abs(T31(i+1)-T31(i))/T31(i+1)*100;
error_T32(i+1)=abs(T32(i+1)-T32(i))/T32(i+1)*100;
error_T33(i+1)=abs(T33(i+1)-T33(i))/T33(i+1)*100;
i=i+1;
end
disp(i);
T11=T11(i);T12=T12(i);T13=T13(i);T21=T21(i);T22=T22(i);T23=T23(i);T31=T31(i);T32=T32(i);T33=T33(i);
disp(' T11 ');
% disp([T11',error_T11']);
disp(T11);disp(T12);disp(T13);disp(T21);disp(T22);disp(T23);disp(T31);disp(T32);disp(T33);
4 Kommentare
Akzeptierte Antwort
KSSV
am 16 Mär. 2016
It shall be easy....You will be having X,Y,T of size mXn each. Use surf(X,Y,T).
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Statics and Dynamics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!