Answer to Question #211780 in MatLAB for Vijay

Question #211780

Write a MATLAB code to solve the following difference equations by z-transform and display the solutions by stem plots:


2) Suppose that the number of bacteria in a colony doubles every hour. If a colony begins with five bacteria, how many will be present in n hours?


1
Expert's answer
2021-06-29T05:52:44-0400


close all,
clear all,
clc,



a=5;
syms n z
f = a*2^(n-1);
disp(['Z-Transform: f = ',32,num2str(a),'*2^(n-1):']);
fZT = ztrans(f)
disp(['No. of bacteria at the end of n hours = ']);
IZT = iztrans(fZT)

Grwoth=[];
for r=1:10
    n=r;
    Growth(r) = 5/2*2^n;
end
stem(Growth);
title('Stem Plot: Bacteria Growth','FontSize',20);
xlabel('--- t (Hours) --->');
ylabel('--- Growth --->');
grid on,





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS