{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

BENG449 Problem 8 4

# BENG449 Problem 8 4 - 12:55 AM MATLAB Command Window 1 of 3...

This preview shows pages 1–3. Sign up to view the full content.

4/11/08 12:55 AM MATLAB Command Window 1 of 3 >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Alex Lemon % % BENG449 -- Biomedical Data Analysis % % Problem Set 8, Question 4 % % Due April 11, 2008 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Consider a model with three compartments: the absorption site (A), the % body (B) and the elimination site (E) with the following rate constants: % k0 : A --> B % km1 : B --> A % k1 : B --> E % Tabulate the eigenvalues and simulate the system. % Initialize the parameters clear A B E; k0 = 0.01; k1 = 0.035; KM1 = [0, 0.01, 0.035, 0.1]; c0 = [1; 0; 0]; N = length(KM1); S = length(c0); t = [0:250]; T = length(t); for n = 1:N % Form the transition matrix km1 = KM1(n); K = [-k0 km1 0; k0 -(k1 + km1) 0; 0 k1 0]; % Compute the eigenvalues and eigenvectors [V L] = eig(K); % Print the eigenvalues fprintf('\n%s%.6f%s\n%s%10.6f\n%s%10.6f\n%s%10.6f\n', ... 'The eigenvalues for km1 = ', km1, ' are:', ... ' lambda_1: ', L(1,1), ... ' lambda_2: ', L(2,2), ... ' lambda_3: ', L(3,3)); % Simulate the system C = zeros(S, T); % Compute the time evolution of the system for i = 1:T C(:,i) = V * expm(L * t(i)) * inv(V) * c0; end % Store the results A{n} = C(1,:);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4/11/08 12:55 AM MATLAB Command Window 2 of 3 B{n} = C(2,:); E{n} = C(3,:); end % Plot the results clf; figure(1); hold on; plot(t, A{1}, ...
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}