how can I compute the indefinite integral of an anonymous function?
f=1010;
d= 0:0.0001:8;
z = @(d) sawtooth(2*pi*f*d+pi,0);

3 comentarios

Torsten
Torsten el 23 de Oct. de 2022
If you are lucky, using the symbolic toolbox and "int".
"sawtooth" is a numerical function.
Thus you will have to compute the indefinite integral from above using pencil and paper.
William Lancelot
William Lancelot el 23 de Oct. de 2022
thank you for your reply
I did compute the integral of the above function symbolically using syms and int and a bunch of heavisides. However, I can't use anything symbolic when I try to import the result in Simulink. I converted the symbolic expression with matlabFunction, but I do not know how to use it in Simulink
William Lancelot
William Lancelot el 23 de Oct. de 2022
I am trying to plot the above function and its integral in Simulink

Iniciar sesión para comentar.

 Respuesta aceptada

Torsten
Torsten el 23 de Oct. de 2022
f = 1010;
z = @(d) sawtooth(2*pi*f*d+pi,0);
dstart = 0.0;
dend = 0.01;
delta_d = 1e-5;
d = dstart:delta_d:dend;
intz = cumtrapz(d,z(d));
hold on
yyaxis left
plot(d,z(d))
yyaxis right
plot(d,intz)
hold off

Más respuestas (0)

Productos

Versión

R2021b

Etiquetas

Preguntada:

el 23 de Oct. de 2022

Respondida:

el 23 de Oct. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by