Sending parameters to a function
Show older comments
I have a function that looks like this:
function ci = cifun(y,T,TM,TMO,G2,A,b,x,Epsi,ny,Vc,c2,D2,Q)
syms G2;syms T;syms TM;syms TMO;syms ny;syms A;syms Epsi;
syms b;syms x;syms y;syms Vc;syms c2;syms D2;syms Q;syms z;
R = 8.314472;
k = 1.38065E-23;
D = D2.*exp(-Q./(R.*T));
cidel = matlabFunction(cidelfun, 'Vars',{'z' 'T' 'TM' 'TMO' 'G2' 'A' 'b' 'x' 'Epsi' 'ny' 'D2' 'Q' 'R' 'Vc'});
cidelfun2 = @(z) cidel(z,T,TM,TMO,G2,A,b,x,Epsi,ny,D2,Q,R,Vc);
ci = ((Vc.*c2)./D).*exp(-(Wifun./(T.*k))-(Vc.*y./D))*quad(cidelfun2,-250*b,250*b);
end
It needs certain parameters to work and if I write them in the function it works. But the problem is that I'm going to use this function with different parameters different times so I need to send them along when I call the function. I tried to write like this:
T = 1273;
TM = 2163;
TMO = -0.5;
G2 = 126000;
A = 1.2E-29;
b = 0.000000000258;
x = 2/3*b;
Epsi = 0.00487903650119246;
ny = 0.3;
D2 = 0.0000169;
Vc = 1E-9;
c2 = 18.07551;
Q = 263900;
R = 8.314472;
ci = cifun(T,TM,TMO,G2,A,b,x,Epsi,ny,Vc,c2,D2,Q)
But it don't work. So my question is how to do to make it work?
Accepted Answer
Categories
Find more on Assumptions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!