Not enough input arguments
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Adriaan Kruger
am 20 Sep. 2019
Kommentiert: Adriaan Kruger
am 20 Sep. 2019
The live script is attached, but the code is as follows:
fplot(f,[-1 4])
grid on
title('y=x^3-4*x^2+2*x-4')
xlabel('x');
ylabel('y');
hold on
f(3)-f(5)
Differentiation=diff(y, x)
Integtgral=integral(f,-1,4)
function y=f(x)
y=x^3-4*x^2+2*x-4
end
How do I fix the "not enough input arguments" error and also how do I get the integral to work?
0 Kommentare
Akzeptierte Antwort
Stephen23
am 20 Sep. 2019
Bearbeitet: Stephen23
am 20 Sep. 2019
integral(@f,-1,4)
% ^^ the first input needs to be a function handle!
3 Kommentare
Rik
am 20 Sep. 2019
The outputs are caused by your omission of a semicolon. If you replace ^ and * by .^ and .* to make sure your function works for array inputs.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numbers and Precision finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!