0% found this document useful (0 votes)
15 views2 pages

MATLAB Code for Penicillin Modeling

This document contains MATLAB code that models the growth of penicillium and production of penicillin over time. It uses the ode45 function to solve the system of nonlinear differential equations describing the process. It generates two plots, one for each variable, showing their values over time. In the comments, it notes that the linearized model is not a valid approximation since the original equations are nonlinear, and that for this process inaccurate mixing characteristics do not significantly impact the results after the initial 20 minutes.

Uploaded by

KravishIQIce
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

MATLAB Code for Penicillin Modeling

This document contains MATLAB code that models the growth of penicillium and production of penicillin over time. It uses the ode45 function to solve the system of nonlinear differential equations describing the process. It generates two plots, one for each variable, showing their values over time. In the comments, it notes that the linearized model is not a valid approximation since the original equations are nonlinear, and that for this process inaccurate mixing characteristics do not significantly impact the results after the initial 20 minutes.

Uploaded by

KravishIQIce
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Part (b) – MATLAB Code and Plots

function ctrl = controls()


clear all;
close all;

A = [9.479 848.7];

trange = [0:1000];

[t,y] = ode45(@odefun,trange,A);

figure;
plot(t,y(:,1))
title('x1 - penicillium')
figure;
plot(t,y(:,2))
title('x2 - penicillin')

return

function dXdt = odefun(t, A)


dXdt = zeros(2,1);

dXdt(1) = 0.03120*A(1)*(1-A(1)/47.70) - 0.02125*A(1); %x1 penillium


dXdt(2) = 3.374*A(1)-0.01268*A(2) - 0.02125*A(2); %x2 penicillin

return
Part (d) – Plotting Linear vs. Nonlinear

Can’t see non linear model since magnitude of linearized model is so large and negative. Probably not a
valid model, which makes sense since original equations are nonlinear.

Part (g)

Part (h)

Well, unless you care about the initial 20 mins where there is a slight difference, there’s no need to
accurately model mixing characteristics for this process because inaccurate modeling yields a very
similar result.

You might also like