how can I plot y=log(2,(2-a)) ?

1 回表示 (過去 30 日間)
Moj
Moj 2013 年 8 月 26 日
How can I plot y = log(2,(2-a) in matlab: I have written this code but unfortunately I encounter with errors:
a = 0:0.2:1;
C_ro = plot(-(a./2).*log(2,a./2) - ((2 - a)./2).*log(2,(2 - a)./2));
plot(a, C_ro)
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 26 日
What is log(a,b)?

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

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 26 日
編集済み: Azzi Abdelmalek 2013 年 8 月 26 日
Maybe you want this (if log(2,b)=log(b)/log(2))
a = 0:0.2:1;
C_ro = -(a/2).*log(a/2)/log(2) - ((2 - a)/2).*log((2 - a)/2)/log(2);
plot(a, C_ro)

その他の回答 (1 件)

Osama AlThahab
Osama AlThahab 2013 年 8 月 26 日
your code is wrong, remove plot from C_ro

カテゴリ

Help Center および File ExchangePrice and Analyze Financial Instruments についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by