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?
close all,
clear all,
clc,
a=5; % Initial Bacteria Value
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)
Comments
Leave a comment