⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e422.m

📁 学习Matlab循环语句的好例子
💻 M
字号:
% Script file:E422.m
% Purpose:
% Write a program that calculates and plots the number of bacteria present 
% in each culture at intervals of 3 hours from the beginning of experiment
% until 24 hours have elapsed

% Record of revisions
%   Date           Programmer            Descripton of changes
% =============   ===============  ================================
%  13/06/08         ZMW                Original Code

% Define Variables
% t   ----------the time,hour as unit
% numA ----------bacteria A's number
% numB ----------bacteria B's number
% ii    ---------the index

numA=ones(1,9);
numB=ones(1,9);
ii=1;
for t=0:3:24
    numA(ii)=2^t;
    numB(ii)=2^(2*t./3);
    ii=ii+1;
end
t=0:3:24;

plot(t,numA,'b-');
hold on 
plot(t,numB,'r-');
title('\bf t VS num(general plot)');
legend('numA','numB');
hold off
figure;

semilogy(t,numA,'b-');
hold on;
semilogy(t,numB,'r-');
title('\bf t VS num(semilogy plot)');
legend('numA','numB');
hold off

    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -