How to make countour plot zoomed out
4 ビュー (過去 30 日間)
古いコメントを表示
For the following code, my plot displayed is zoomed in too far, so I can't view all of the area I would like to. How do I adjust this so I can see the whole thing.
The object in the plot is multiple squres inside of each other.
MATLAB CODE:
function HeatTransfer ()
%i=1;
%j=1;
k=3.1;
hi=85.0;
ho=12;
Ti=380;
To=15;
x=.0010;
y=.0010;
T=ones(21,14);
itermax=1000000;
iter=1;
%Interior Node
%while i<=21 && j<=14
while iter<itermax
for i=6:16
for j=5:10
T(i,j)=380;
end
end
for i=2:5
for j=2:13
T(i,j)=(T(i,j+1)+T(i,j-1)+T(i+1,j)+T(i-1,j))/4;
end
end
for i=6:16
for j=2:4 %|| j=11:13
T(i,j)=(T(i,j+1)+T(i,j-1)+T(i+1,j)+T(i-1,j))/4;
end
end
for i=6:16
for j=11:13
T(i,j)=(T(i,j+1)+T(i,j-1)+T(i+1,j)+T(i-1,j))/4;
end
end
for i=17:20
for j=2:13
T(i,j)=(T(i,j+1)+T(i,j-1)+T(i+1,j)+T(i-1,j))/4;
end
end
%Node @ External Corder
%for j=1 %|| j=14
% n=1;
T(1,1)=((T(i,j-1)+T(i-1,j))+2*ho*x*To/k)/(2*(ho*x/k+2));
%end
%for i=1
% for j=14
T(1,14)=((T(i,j-1)+T(i-1,j))+2*ho*x*To/k)/(2*(ho*x/k+2));
% end
%end
%for i=21
%for j=1 %|| j=14
T(21,1)=((T(i,j-1)+T(i-1,j))+2*ho*x*To/k)/(2*(ho*x/k+2));
%end
%end
%for i=21
%for j=14
T(21,14)=((T(i,j-1)+T(i-1,j))+2*ho*x*To/k)/(2*(ho*x/k+2));
%end
%end
%Node @ Plane Surface
%for i=1
for j=2:13
T(1,j)=(2*T(i-1,j)+T(i,j+1)+T(i,j-1)+2*ho*x*To/k)/(2*(ho*x/k+2));
end
%end
for i=2:20
%for j=1 %|| j=14
T(i,1)=(2*T(i-1,j)+T(i,j+1)+T(i,j-1)+2*ho*x*To/k)/(2*(ho*x/k+2));
%end
end
for i=2:20
%for j=14
T(i,14)=(2*T(i-1,j)+T(i,j+1)+T(i,j-1)+2*ho*x*To/k)/(2*(ho*x/k+2));
%end
end
%if i==21
for j=2:13
T(21,j)=(2*T(i-1,j)+T(i,j+1)+T(i,j-1)+2*ho*x*To/k)/(2*(ho*x/k+2));
end
%end
%Node @ Internal Corner
%for i=6
% for j=5 %|| j=10
T(6,5)=(2*(T(i-1,j)+T(i,j+1))+(T(i+1,j)+T(i,j-1))+2*hi*x*Ti/k)/(2*(3+hi*x/k));
%end
%end
%for i=6
% for j=10
T(6,10)=(2*(T(i-1,j)+T(i,j+1))+(T(i+1,j)+T(i,j-1))+2*hi*x*Ti/k)/(2*(3+hi*x/k));
% end
%end
%for i=16
% for j=5 %|| j=10
T(16,5)=(2*(T(i-1,j)+T(i,j+1))+(T(i+1,j)+T(i,j-1))+2*hi*x*Ti/k)/(2*(3+hi*x/k));
%end
%end
%for i=16
%for j=10
T(16,10)=(2*(T(i-1,j)+T(i,j+1))+(T(i+1,j)+T(i,j-1))+2*hi*x*Ti/k)/(2*(3+hi*x/k));
%end
%end
%Node at Internal Edge
for i=6:16
%for j=5 %|| j=10
T(i,5)=(2*T(i-1,j)+T(i,j+1)+T(i,j-1)+2*hi*x*Ti/k)/(2*(hi*x/k+2));
%end
end
for i=6:16
T(i,10)=(2*T(i-1,j)+T(i,j+1)+T(i,j-1)+2*hi*x*Ti/k)/(2*(hi*x/k+2));
%end
end
%for i=6 %|| i=16
for j=5:10
T(6,j)=(2*T(i-1,j)+T(i,j+1)+T(i,j-1)+2*hi*x*Ti/k)/(2*(hi*x/k+2));
end
%end
%for i=16
for j=5:10
T(16,j)=(2*T(i-1,j)+T(i,j+1)+T(i,j-1)+2*hi*x*Ti/k)/(2*(hi*x/k+2));
end
iter=iter+1;
end
colormap(jet)
contour(T)
disp(T)
fprintf('minimum temperature=')
disp(min(T,[],'all'))
fprintf('maximum temperature=')
disp(max(T,[],'all'))
end
0 件のコメント
採用された回答
Piyush Lakhani
2020 年 3 月 11 日
Simplest way to doing this is by setting the axis limits.
Here i am just mentioning one example.
contour(T)
xlim([-20 20]) % Here -20 to 20 are x axis limit. As i can see you are plotting just 'T' your x data may be just index of data points, so might your limit start from 0 to number of data points.
ylim([-10 10]) % Similar to x also limit the y
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Two y-axis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!