i am trying to get the value for b.
where
t = [89;132;202;263;321;362;421;473;575;663]
n=10;
syms b
[b] = solve((1/b) + sum(log(t))/10 - 1.*sum(t.^b).*log(t)/(sum(t.^b))==0)
i tried this code to find 'b' but i am not getting the value of 'b'. How can i get the value for 'b'?

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 10월 23일

1 개 추천

If you want to find value of 'b' for each value of 't' then try this
tv = [89;132;202;263;321;362;421;473;575;663];
syms b t
b_sol = solve((1/b) + sum(log(t))/10 - 1/(sum(t.^b)/10).*sum(t.^b).*log(t)==0, b);
b_vals = subs(b_sol, t, tv)

댓글 수: 5

MD. Rokibujjaman sovon
MD. Rokibujjaman sovon 2020년 10월 23일
편집: MD. Rokibujjaman sovon 2020년 10월 23일
i am not looking for each t. 'b' will have a single value and it would be 2.0924
Ameer Hamza
Ameer Hamza 2020년 10월 23일
Can you show your equation in latex form?
MD. Rokibujjaman sovon
MD. Rokibujjaman sovon 2020년 10월 23일
i added the question.
You were also dividing the term in the denominator by 10. Try the following code
t = [89;132;202;263;321;362;421;473;575;663]
n=10;
syms b
b_sol = solve((1/b) + sum(log(t))/10 - 1/(sum(t.^b)).*sum((t.^b).*log(t))==0)
Result
b_sol =
2.0923855034345368572888674897445
MD Rokibujjaman Sabuj
MD Rokibujjaman Sabuj 2020년 10월 23일
Thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2020년 10월 23일

0 개 추천

Your t is a vector.
[b] = solve((1/b) + sum(log(t))/10 - 1/(sum(t.^b)/10).*sum(t.^b).*log(t)==0)
You have log(t) there at the end, in a context that is not inside a sum() like the rest of the places you use t. Therefore you are generating a vector of equations, and you are asking solve() to find a single t that solves all of the equations simultaneously.
You need to re-check your last term. For example there is a numeric solution for
vpasolve((1/b) + sum(log(t))/10 - 1/(sum(t.^b)/10).*sum(t.^b.*log(t))==0, 0.02)

카테고리

Community Treasure Hunt

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

Start Hunting!

Translated by