フィルターのクリア

How to use mod function in this question

1 回表示 (過去 30 日間)
Ketul Patel
Ketul Patel 2017 年 9 月 13 日
コメント済み: Ketul Patel 2017 年 9 月 13 日
Hi, the question follows as: bacterial growth in lab follows, N = No*exp(k*t), where the value of k = 1.03454, how do we solve it for 24 hours of time, and plot the number of bacteria at the interval of 2 hours. I tried this script, but can't do further as for loop with mod condition is giving an error, whereas other loops are sometimes producing only points in the graph.
k = 1.034548030686485;
No = 1;
clf
for t = [1:24]
N(t) = No* exp(k*t)
end
I read online that while calling that function I might be doing one at a time or something similar. Could anyone please explain? Thanks

採用された回答

Christoph F.
Christoph F. 2017 年 9 月 13 日
t=1:24;
N=No*exp(k*t);
plot(t(1:2:end), N(1:2:end), 'kx-');
  1 件のコメント
Ketul Patel
Ketul Patel 2017 年 9 月 13 日
Hi, Thanks for the answer, it solved the problem, but is there anyway i could do that with using mod function? Like, After doing the syntax i used before, T = 1:24; If mod(t, 2)==0 Plot(N,t) End
Or Somewhat similar?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by