log2(x)

7 次查看(过去 30 天)
nastya nastya
nastya nastya 2020-5-24
评论: Gautam 2020-5-24
Здравствуйте, помогите пожалуйста исправить ошибку.
Пишу функцию:
function [F] = log2(x)
F = log(x)/log(2);
end
Но мне выдает ошибку:
Not enough input arguments.
Error in log2 (line 2)
F = log(x)/log(2);
  2 个评论
nastya nastya
nastya nastya 2020-5-24
function [F] = log2(x)
F = log(x)/log(2);
end
Gautam
Gautam 2020-5-24
After writing your function save the file. Then in MATLAB command prompt try
>> value = log2(10);
PS: You dont have to create this function. Since log2 is a built-in MATLAB function https://www.mathworks.com/help/matlab/ref/log2.html

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by