What function do I use instead of "matlabFunction"?

1 次查看(过去 30 天)
It runs for a very long time and I need this function to use for define a function in my equation.
I want to define a function without use "matlabFunction". What function do i use to define a function?
Thank for help.
Example code
% Riemann summation loop
n2 = 1
dx1 = (TopR1-DownR1)/n2;
dy1 = (TopR2-DownR2)/n2;
dz1 = (TopR3-DownR3)/n2;
sumx = 0;
sumy = 0;
myequation = 0;
for i1 = 1:n2
sumx=sumx+subs(U2,x1,dx1*rand+(DownR1+(i1-1)*dx1)); % U2 is a function have 4 variables
end
sumx = sumx*dx1;
for j1 = 1:n2
sumy=sumy+subs(sumx,y1,dy1*rand+(DownR2+(j1-1)*dy1));
end
sumy = sumy*dy1;
for k1 = 1:n2
myequation=myequation+subs(sumy,z1,dz1*rand+(DownR3+(k1-1)*dz1));
end
myequation =myequation*dz1;
% plot graph
F1 = matlabFunction(myequation);
% range of varaible d
d = 0:0.01*(10^-9):20*(10^-9);
Potential = zeros(length(d));
for i1 = 1:length(d)
Potential(i1) = F1(d(i1));
end
figure('Name','Potential','NumberTitle','off');
plot(d,Potential)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by