fplot too many input arguments

5 visualizaciones (últimos 30 días)
Jonathan Stanton
Jonathan Stanton el 12 de Mzo. de 2020
Comentada: Jonathan Stanton el 12 de Mzo. de 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

Respuestas (1)

Piyush Lakhani
Piyush Lakhani el 12 de Mzo. de 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

Categorías

Más información sobre String Parsing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by