What function do I use instead of "matlabFunction"?

1 vue (au cours des 30 derniers jours)
chayanon summueang
chayanon summueang le 12 Fév 2019
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)
  3 commentaires
madhan ravi
madhan ravi le 12 Fév 2019
Also I don't see why your using a loop.
chayanon summueang
chayanon summueang le 12 Fév 2019
Modifié(e) : chayanon summueang le 12 Fév 2019
I upload "myequation". It is a loop after Riemann summation and U2 is a function that have 4 variables.
*4 variables. Sorry

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by