Fick's 2nd Law of Diffusion using Method of Lines

PDE solution using Method of Lines
255 download
Aggiornato 26 apr 2019

Visualizza la licenza

%% Method of Lines with D = diffusivity: Fick's 2nd Law of Diffusion
% by Prof. Roche C. de Guzman
%% Custom fx
function Y1 = F(~,Y,D,nx,dx)
c = Y; % assign concentration as Y
Y1 = zeros(nx,1); % temporary derivatives
for i = 1:nx-2 % position counter
Y1(i+1) = D*(c(i+2)-2*c(i+1)+c(i))/dx^2; % solve for derivatives
end
Y1 = [Y1(2); Y1(2:nx-1); Y1(nx-1)]; % derivatives with zero-flux boundary
end

Cita come

Roche de Guzman (2024). Fick's 2nd Law of Diffusion using Method of Lines (https://www.mathworks.com/matlabcentral/fileexchange/71354-fick-s-2nd-law-of-diffusion-using-method-of-lines), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2019a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release
1.0.0