how do I integrate a pre-recorded function?

1 visualización (últimos 30 días)
Pavel Kuzmitsky
Pavel Kuzmitsky el 24 de Abr. de 2021
Respondida: Star Strider el 24 de Abr. de 2021
I tried to write it as follows, but it gives an error
syms r theta
p1 = r.* cos(theta);
polarfun = @(r,theta) p1;
q = integral2(polarfun,0,1,0,2*pi)
please tell me how to do this correctly?

Respuesta aceptada

Star Strider
Star Strider el 24 de Abr. de 2021
Try this —
syms r theta
p1 = r.* cos(theta);
polarfun(r,theta) = p1
polarfun(r, theta) = 
polarfcn = matlabFunction(polarfun) % Slightly Renamed To Avoid Over-Writing Original
polarfcn = function_handle with value:
@(r,theta)r.*cos(theta)
q = integral2(polarfcn,0,1,0,2*pi)
q = 1.5446e-14
.

Más respuestas (0)

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by