my equation has 3 variables but i want to integrate with respect to only one variable ,so that i can optimize the ramaining two from the resulting equation
    7 views (last 30 days)
  
       Show older comments
    
    bhanu kiran vandrangi
 on 27 Jul 2021
  
    
    
    
    
    Commented: bhanu kiran vandrangi
 on 27 Jul 2021
            my equation(looks big) is as follows , which has three variables (d,e,t) I want to integrate with t from 0 to 2000 (by keeping d,e constant ) so that i can optimize those two using any optimization method . i used int(err,0,2000) command but gettting no result .so how to get past this error?
the eqaution at its basic term is in form 1483/(k-1) , where K=function(d,e,t)
err =
1483/(200*(0.99966444607127868948737159371376*d - 99966.44460712373256683349609375*d*(0.0000000061953699799058132798891540549135*exp(-0.031830333683444479980079178105257*t) + 0.000010273947474151098879779908656928*exp(-9.1132612523704400742108333588476*t) - 0.00000028014284413259036773946597520535*exp(-0.21190841394611541767881157660725*t)) + 15567.003559999167919158935546875*e*(0.0000000061953699799058132798891540549135*exp(-0.031830333683444479980079178105257*t) + 0.000010273947474151098879779908656928*exp(-9.1132612523704400742108333588476*t) - 0.00000028014284413259036773946597520535*exp(-0.21190841394611541767881157660725*t)) + 919819.0186288356781005859375*d*(0.00000019463729288918805472585749072323*exp(-0.031830333683444479980079178105257*t) + 0.0000011273623338164517199144754044937*exp(-9.1132612523704400742108333588476*t) - 0.0000013219996267057210898032693080495*exp(-0.21190841394611541767881157660725*t)) - 143208.7303999960422515869140625*e*(0.00000019463729288918805472585749072323*exp(-0.031830333683444479980079178105257*t) + 0.0000011273623338164517199144754044937*exp(-9.1132612523704400742108333588476*t) - 0.0000013219996267057210898032693080495*exp(-0.21190841394611541767881157660725*t)) - 79516.5081846714019775390625*d*(0.0000061148367096900205219789370403305*exp(-0.031830333683444479980079178105257*t) + 0.00000012370569685174297169805157636802*exp(-9.1132612523704400742108333588476*t) - 0.0000062385424065411129723734973140381*exp(-0.21190841394611541767881157660725*t)) + 6144.9373500002548098564147949219*e*(0.0000061148367096900205219789370403305*exp(-0.031830333683444479980079178105257*t) + 0.00000012370569685174297169805157636802*exp(-9.1132612523704400742108333588476*t) - 0.0000062385424065411129723734973140381*exp(-0.21190841394611541767881157660725*t)) - 1))
0 Comments
Accepted Answer
  Alan Weiss
    
      
 on 27 Jul 2021
        This seems like a solution. Of course, I don't know what your real bounds are on d and e, so I just guessed.
Notice that I used ./ in the first line of the function myfun. That is because the integral function requires vectorized inputs.
lb = [1/2 1/2];
ub = [3/4 3/4];
[sol,fval,eflag,output] = fmincon(@minfn,[1/2 1/2],[],[],[],[],lb,ub)
function minit = minfn(x)
d = x(1);
e = x(2);
minit = intval(d,e);
end
function r = intval(d,e)
r = integral(@(t)myfun(d,e,t),0,2000);
end
function val = myfun(d,e,t)
val = 1483./(200*(0.99966444607127868948737159371376*d - ...
    99966.44460712373256683349609375*d*(0.0000000061953699799058132798891540549135*exp(-0.031830333683444479980079178105257*t) +...
    0.000010273947474151098879779908656928*exp(-9.1132612523704400742108333588476*t) -...
    0.00000028014284413259036773946597520535*exp(-0.21190841394611541767881157660725*t)) + ...
    15567.003559999167919158935546875*e*(0.0000000061953699799058132798891540549135*exp(-0.031830333683444479980079178105257*t) +...
    0.000010273947474151098879779908656928*exp(-9.1132612523704400742108333588476*t) -...
    0.00000028014284413259036773946597520535*exp(-0.21190841394611541767881157660725*t)) +...
    919819.0186288356781005859375*d*(0.00000019463729288918805472585749072323*exp(-0.031830333683444479980079178105257*t) +...
    0.0000011273623338164517199144754044937*exp(-9.1132612523704400742108333588476*t) -...
    0.0000013219996267057210898032693080495*exp(-0.21190841394611541767881157660725*t)) -...
    143208.7303999960422515869140625*e*(0.00000019463729288918805472585749072323*exp(-0.031830333683444479980079178105257*t) +...
    0.0000011273623338164517199144754044937*exp(-9.1132612523704400742108333588476*t) -...
    0.0000013219996267057210898032693080495*exp(-0.21190841394611541767881157660725*t)) -...
    79516.5081846714019775390625*d*(0.0000061148367096900205219789370403305*exp(-0.031830333683444479980079178105257*t) +...
    0.00000012370569685174297169805157636802*exp(-9.1132612523704400742108333588476*t) -...
    0.0000062385424065411129723734973140381*exp(-0.21190841394611541767881157660725*t)) +...
    6144.9373500002548098564147949219*e*(0.0000061148367096900205219789370403305*exp(-0.031830333683444479980079178105257*t) +...
    0.00000012370569685174297169805157636802*exp(-9.1132612523704400742108333588476*t) -...
    0.0000062385424065411129723734973140381*exp(-0.21190841394611541767881157660725*t)) - 1));
end
Alan Weiss
MATLAB mathematical toolbox documentation
More Answers (0)
See Also
Categories
				Find more on Particle Swarm 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!
