Integral as part of a function

2 Ansichten (letzte 30 Tage)
Jhed Maui Kajiyama
Jhed Maui Kajiyama am 28 Mai 2022
Bearbeitet: Jan am 28 Mai 2022
I want to input this as a function of x in matlab because I need to plot it
how do I input this definite integral inside the function?

Akzeptierte Antwort

Jan
Jan am 28 Mai 2022
Bearbeitet: Jan am 28 Mai 2022
% As anonymous function:
f = @(x) integral(@(t) 2 * sqrt(0.0625 - t.^2), -0.25, x - 0.25) / 0.0981747704247;
f(13)
ans = 1.9999e+00 + 1.6526e+03i
% As function:
g(13)
ans = 1.9999e+00 + 1.6526e+03i
function y = g(x)
y = integral(@(t) 2 * sqrt(0.0625 - t.^2), -0.25, x - 0.25) / 0.0981747704247;
end

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by