Plot a line out of a 2D array
1 view (last 30 days)
Show older comments
I have a 2D array of 120 x 50 . This is a 1-D Carburisation Problem program to find out concentration profile of C from surface to centre.
So herein, i wish to highlight and showcase only the value of C after 1hr , 3hr and 10hrs and plot them
How do i do that?
% Geometrical parameters
Cs = 1;
L = 0.005; %length of steel piece
D = 2*10^(-11); %diffusivity of carbon in iron
N = 50; %number of grid points
dx = L/(N-1);
x = [0:dx:L];
t = 36000; % total time 10hrs
dt = 300; % time step
K = t/dt; %iteartion
Co(1:K,1:N)= 0.20;
C(1:K,1:N) = 0.20;
AE(1:N) = D/(dx);
AE(1) = 0; % west boundary
AE(end) = 0; % east boundary
AW(1:N) = D/(dx);
AW(1) = 0; % west boundary
Apo(1:N) = dx/(dt);
Apo(end) = dx/(2*(dt));
AP = AE + AW + Apo;
AP(1) = 1;
p = -AW;
q = AP;
r = -AE;
d(1:N) = 0;
for i = 1:K
d = Apo.*Co(i,1:N);
d(1) = Cs;
C(i,1:N) = TDMA(p,q,r,d);
Co(i+1,1:N) = C(i,1:N);
end
2 Comments
Answers (0)
See Also
Categories
Find more on Solar Power in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!