How could I display my input function and its indefinite first integral (their graphs as outputs) ?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Roger Vegeta
am 28 Jul. 2016
Beantwortet: Star Strider
am 28 Jul. 2016
Tanking in consideration that I want the range for x from -100 to 100.
Thanks so much. I appreciate it.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 28 Jul. 2016
The integral function is going to produce one point — the value of the entire integral. If you want to plot it, use cumtrapz:
a = 2; % Input Value
b = 3; % Input Value
fun = @(x) x.^2; % Create Function To Test Code
x = linspace(a, b);
q = cumtrapz(x,fun(x));
fprintf('\n f = %6.4f\n',q(end)-q(1))
figure(1)
plot(x, q)
grid
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots 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!