Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

2 integrals at once?

조회 수: 1 (최근 30일)
Danielle Richard
Danielle Richard 2019년 9월 20일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi, I''m looking to get a numerical value for dG. The first two integrals are with respect to a same variable T, but the last one is with respect to a different variable, P. Is there a special notation when solving type of problem?
%Iterate Tmax until dG=0
Tmax=1100
dG=dH+integral(dCp1,1000,Tmax)-Tmax.*(dS+integral(dCp2,1000,Tmax))+ integral(dV1,1,P1)
  댓글 수: 1
madhan ravi
madhan ravi 2019년 9월 20일
Provide the missing datas.

답변 (2개)

Walter Roberson
Walter Roberson 2019년 9월 20일
No, there is no special notation.
What you pass as the first parameter to integral() must be the handle to a function that accepts one variable. It does not matter for the purpose of integral() what that variable represents or what you named it: it only cares that it can pass a value as the first parameter and get a result back.
If you do not pass 'arrayvalued', true to integral() as options, then the function must accept an array of x values and return something that is the same size.

Steven Lord
Steven Lord 2019년 9월 20일
The integral function doesn't care what name your integrand function uses for its input argument. All it really cares about is that your integrand function accepts an input argument and returns an output argument, and that both the input and the output arguments are the sizes described on the documentation page for the integral function. The expected size information is located in the fun input argument section.
fun1 = @(x) x.^2;
fun2 = @(elephant) elephant.^2;
fun3 = @(I_am_the_very_model_of_a_modern_major_general) ...
I_am_the_very_model_of_a_modern_major_general.^2;
y = zeros(3, 1);
y(1) = integral(fun1, 0, 5);
y(2) = integral(fun2, 0, 5);
y(3) = integral(fun3, 0, 5);
disp(y)
allResultsEqual = all(y == y(1))
y(1) is the result of , y(2) is the result of , and similarly for y(3).

태그

Community Treasure Hunt

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

Start Hunting!

Translated by