fplot too many input arguments

7 ビュー (過去 30 日間)
Jonathan Stanton
Jonathan Stanton 2020 年 3 月 12 日
コメント済み: Jonathan Stanton 2020 年 3 月 12 日
Hi, Stuggling to see where i am going wrong,
Run the code and tells me :
Warning: Error updating FunctionLine.
The following error was reported evaluating the function in
FunctionLine update: Too many input arguments.
Warning: Error updating FunctionLine.
The following error was reported evaluating the function in
FunctionLine update: Too many input arguments.
function plotFun()
%X1 = abs(sin(x)
%X2 = abs(sin(x/4)
hold on
fplot(@(x)abs(log(sin(x)),[-4*pi, 4*pi],'k:'));
fplot(@(x)abs(log(sin(x/4)),[-4*pi, 4*pi],'g-'));
hold off
end
its only beginner stuff but am stuck.
Thanks for the advice
Jon

回答 (1 件)

Piyush Lakhani
Piyush Lakhani 2020 年 3 月 12 日
Hi Jonathan,
I am not getting why you are running this function file. But, still if you required to run this you missed the brackets.
Corrected Code,
function plotFun()
%X1 = abs(sin(x)
%X2 = abs(sin(x/4)
hold on
fplot(@(x)abs(log(sin(x))),[-4*pi, 4*pi],'k:'));
fplot(@(x)abs(log(sin(x/4))),[-4*pi, 4*pi],'g-'));
hold off
end
If you are just intrested in plot then you may use following code that will give direct output.
hold on
fplot(@(x)abs(log(sin(x))),[-4*pi, 4*pi])
fplot(@(x)abs(log(sin(x/4))),[-4*pi, 4*pi])
hold off
  1 件のコメント
Jonathan Stanton
Jonathan Stanton 2020 年 3 月 12 日
awsome thanks guys

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by