help me about integral inside integral

조회 수: 1 (최근 30일)
sarngon
sarngon 2015년 4월 19일
편집: Geoff Hayes 2015년 4월 19일
Hello everyone,
I wrote a code for a function that includes inner functions and integral but I get confused I is working but not a professional way can you help me to write it more professional ? Thank you :)
aa=(k*l*vi/(wr*ccons));
bb=@(w) (((1+w/wr*l)*vi/ccons).^(k-1));
cc=@(w) (2.71.^((-((1+w/wr*l)*vi/ccons)).^k));
f3 =@(w)bb(w).*cc(w);
for i=1:num;
dd=@(w)kr*(x1(i)-w);
dd2=@(w)kr*(x2(i)-w);
fw1 =@(w)f3(w).*dd(w);
fw2=@(w)f3(w).*dd2(w);
% x=in(:,3:4);
% Qscalarx = @(x)integral(@(w) kr*(in(:,3:4)-w)*(k*l*vi/(wr*ccons))*(((1+w/wr*l)*vi/ccons).^(k-1))*2.71.^((-((1+w/wr*l)*vi/ccons)).^k),0,x);
% Q = @(x)arrayfun(Qscalarx,x);
% Q(x);
Q1(i) = integral(fw1,0,x1(i));
% fw2 = @(w) kr*(x2(i)-w)*(k*l*vi/(wr*ccons))*(((1+w/wr*l)*vi/ccons).^(k-1))*2.71.^((-((1+w/wr*l)*vi/ccons)).^k);
Q2(i) = integral(fw2,0,x2(i));
end
Q=Q1'+Q2';
Cwsum=dc(1)*(in(:,3))+dc(2)*(in(:,4));
lam=abs(Pd+2.32-sum(in(:,1:4)'))';
totalcost=Cthermal+(Q)+Cwsum+100*lam;
Thank you :)

답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by