fplot too many input arguments

6 views (last 30 days)
Jonathan Stanton
Jonathan Stanton on 12 Mar 2020
Commented: Jonathan Stanton on 12 Mar 2020
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

Answers (1)

Piyush Lakhani
Piyush Lakhani on 12 Mar 2020
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

Community Treasure Hunt

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

Start Hunting!