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

1 visualización (últimos 30 días)
Moj
Moj el 26 de Ag. de 2013
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)

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 26 de Ag. de 2013
Editada: Azzi Abdelmalek el 26 de Ag. de 2013
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)

Más respuestas (1)

Osama AlThahab
Osama AlThahab el 26 de Ag. de 2013
your code is wrong, remove plot from C_ro

Categorías

Más información sobre Price and Analyze Financial Instruments en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by