fplot too many input arguments

조회 수: 8 (최근 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

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by