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

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)

 Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 26 Aug. 2013
Bearbeitet: Azzi Abdelmalek am 26 Aug. 2013

0 Stimmen

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)

Weitere Antworten (1)

Osama AlThahab
Osama AlThahab am 26 Aug. 2013

0 Stimmen

your code is wrong, remove plot from C_ro

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by