How can I change function handles into functions?
显示 更早的评论
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.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!