- Does that mean you received an error? If so, please post the FULL text of that error message (everything displayed in red text.)
- Did you receive a warning? If so, please post the FULL text (everything displayed in orange text.)
- Does it do something else? If so, please describe in detail what happens.
Double Integration. Function handle use
조회 수: 1 (최근 30일)
이전 댓글 표시
I have been trying hard to get to represent the following equation on matlab.
int_c = 1./((2.*pi.*sigma_tot.^2));
fun = @(lx,ly, sigtot) exp ( - ((lx.^2 + ly.^2)./(2*sigtot.^2 )));
lxx = 2 * RR;
lxx_min = -lxx./2;
lxx_max = lxx./2;
lyy_min = @(gamma)(-(RH.* cos(gamma))./2);
lyy_max = @(gamma)((RH.* cos(gamma))./2);
int_i = arrayfun(@(sigtot) integral2( @(xi,yi) fun(xi,yi,sigtot),lxx_min,lxx_max,lyy_min,lyy_max), sigma_tot);
This is what I have so far. Please bear in mind that the following equation was executed inside a loop. sigma_tot and gamma changes with every increasing loop count.
It does provide me with results but my main question is why does lyy_min and lyy_max have to have the function. Without it I will get an error. The true definition is supposed to be
lyy_min =(-(RH.* cos(gamma))./2);
lyy_max = ((RH.* cos(gamma))./2);
However, the code would not run that way. So can anyone pls tell me if what I represented make sense.
Thanks
댓글 수: 6
John D'Errico
2018년 6월 6일
I think what you misunderstand is that if gamma is fixed at some value, then it is fixed at the current value in your workspace. But the limits are functions of gamma. You need to write it as a function, else it will not be used as a function.
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!