clear all
close all
%DEFINING THE GRID (MESH) AND SIZE OF THE DOMAIN
L = 50; %Length of the vertical rock section (m)(use meter, kelvin, second always)
dz = 0.1; % size of the elements (m)
N = L/dz+1; % Number of nodes in the rock column
%DEFINING THE PHYSICAL PROPERTIES
K = 1.8; %Thermal conductivity of the rocks
Cp = 840 %specific heat of the rocks
rho = 3000; %density of the rocks
kappa = K/(Cp*rho); %Diffusivity of the rocks
%INITIALIZE THE VARIABLES
time = 0; %I define the initial time
Tbot = 140;
Tbotnew = 140;
Ttop = 122; %Initial temperature, in degrees centigrade (C)
Ttopnew = linspace(Ttop,Tbot,N); %Initialize the new temperature array
%Plot initial T conditions
x= 1:N:50
y= Ttopnew
plot(x,y,'r');
xlabel('Depth of rock column (m)')
ylabel('Temperature (C)')

댓글 수: 1

Stephen23
Stephen23 2015년 3월 6일
Please edit your question and format the code correctly using the {} Code button that you will find above the textbox.

댓글을 달려면 로그인하십시오.

 채택된 답변

Jan
Jan 2015년 3월 7일

0 개 추천

You N is 501. Then x= 1:N:50 let x be the scalar 1. Inconsequence the plot use one x value only and when I run your code I see a vertical line, as expected.
When you omit the evil clear all you can use the debugger to step through the code line by line.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Animation에 대해 자세히 알아보기

태그

질문:

2015년 3월 6일

답변:

Jan
2015년 3월 7일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by