This is the following code I have:
f = @(t)(160.*(80-r1.*cos(t)))./(8000+r1.^2-160.*r1.*(cos(t).^3/2));
g = @(t)(160.*(80-r2.*cos(t)))./(8000+r2.^2-160.*r2.*(cos(t).^3/2));
q = integral(f,0,2*pi);
p = integral(g,0,2*pi);
Homogenuity_in_Gauss = (q-p)*N*I*10.^-3
%Debugging
r= 7
%Plotting graph
%2D Function
l = @(r,t) (160.*(80-r.*cos(t)))./(8000+r.^2-160.*r.*(cos(t).^3/2));
%Integrate with respect to t
m = @(r) integrate((@t), l, 0, 2*pi);
l
m
Specifically, I am trying to input function l into m and I should get a value for m with all the variables I have defined in this program. However, I am only getting back a string like "m = @(r) integrate((@t), l, 0, 2*pi);" and this cannot be inputted into any other function. It is called a function handle by MATLAB and I want it gone. Is there any way to fix this issue.

 Respuesta aceptada

Star Strider
Star Strider el 3 de Jul. de 2019
You called integral correctly twice, then used the non-existent ‘integrate’ function (unless you created it, regardless, we don’t have it).
Assuming ‘integrate’ is supposed to be integral, try this:
l = @(r,t) (160.*(80-r.*cos(t)))./(8000+r.^2-160.*r.*(cos(t).^3/2));
%Integrate with respect to t
m = @(r) integral(@(t) l(r,t), 0, 2*pi)
r = 7;
mr = m(r)
producing:
mr =
9.984180362002270

Más respuestas (0)

Categorías

Productos

Preguntada:

el 2 de Jul. de 2019

Respondida:

el 3 de Jul. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by