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

조회 수: 2 (최근 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 CenterFile Exchange에서 2-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