Log zu Basis 2 symbolisch rechnen

2 visualizaciones (últimos 30 días)
Fatih
Fatih el 14 de Nov. de 2022
Comentada: Fatih el 15 de Nov. de 2022
Aufgabe: Schreiben Sie eine Funktion, die für eine beliebige (positive) Zahl 𝑧 , die Gleichung 𝑛log(n)− 𝑧 = 0 für den Logarithmus zur Basis 2 symbolisch nach n wie in Beispiel 1 auflöst und 𝑛𝑛 für 𝑧 berechnet und zurückgibt.
Meine Lösung:
% (skalare) Symbole definieren
syms log2(n) z
% symbolische Gleichung definieren
eqn = log2(n) - z == 0
% symbolisches Lösen
symL = solve(eqn)
% % ausrechnen
n= 50;
eval(symL)
% % für eqn linke und rechte Seite der Gleichung plotten
n = 20;
eqn = log2(n) == z
fplot(eqn)
Code gibt immer error und ich weiß nicht wo mein Fehler ist. Kann mir jemand helfen?

Respuestas (1)

Torsten
Torsten el 14 de Nov. de 2022
syms n z positive
eq = n*log2(n) - z == 0
eq = 
sol = solve(eq,n)
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
sol = 
W_0 ist die LambertW Funktion:
  1 comentario
Fatih
Fatih el 15 de Nov. de 2022
perfekt, danke. Es funktioniert jetzt.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!