Try to answer bonus question

2 ビュー (過去 30 日間)
Raiven Balderas
Raiven Balderas 2018 年 2 月 7 日
コメント済み: Birdman 2018 年 2 月 7 日
Screenshot is attached. Comment what the code to the bonus question is. Also provide explanations.

採用された回答

Birdman
Birdman 2018 年 2 月 7 日
編集済み: Birdman 2018 年 2 月 7 日
By using primes built in function of MATLAB:
function y=prime_count(n)
y=numel(primes(n));
plot(primes(n))
end
From command line:
prime_count(10)
>> 4
  3 件のコメント
Birdman
Birdman 2018 年 2 月 7 日
Use this:
plot((1:numel(primes(n)))+1,primes(n),'-o')
Birdman
Birdman 2018 年 2 月 7 日
It does plot. For instance:
n=10;
plot((1:numel(primes(n)))+1,primes(n),'-o')
and check the attached figure.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by