필터 지우기
필터 지우기

Error of "Integrand output size does not match the input size."

조회 수: 2 (최근 30일)
Yi-Kai Peng
Yi-Kai Peng 2023년 8월 5일
편집: Yi-Kai Peng 2023년 8월 5일
Hello,
I am trying to make a double integral over two equtions, respectively. The equations are as following:
v_induced = u .* (1 + a_fit);
v_slipstream = u .* (1 + (2 .* a_fit));
bl_induced = @(u,z) Oper.rho .* (v_induced ./ Oper.Vinf) .* 0.5 .* (Oper.Vinf^2 - (v_induced .^2));
ke_out_induced = @(u,z) Oper.rho .* (v_slipstream ./ Oper.Vinf) .* 0.5 .* ((v_slipstream - Oper.Vinf).^2);
% Perform double integral
q1_induced = integral2(bl_induced, 0, delta99, 0, 2*pi);
q2_induced = integral2(ke_out_induced, 0, delta99, 0, 2*pi);
D_induced = q1_induced + q2_induced;
However, when I am trying to make a double integral, MATLAB throws an error
Integrand output size does not match the input size.
u and a_fit is 1x30 double, and Oper.Vinf and Oper.rho are 1x1 double. I have checked the dimension but I don't see any problem.
Does anyone know what is wrong in my code?
I appriciate any help. Thanks.

채택된 답변

Yi-Kai Peng
Yi-Kai Peng 2023년 8월 5일
편집: Yi-Kai Peng 2023년 8월 5일
Turns out I didn't assign the correct input to the function...
It should be bl_induced = @(v_induced ,z) instead of bl_induced = @(u,z).
Thanks for all the help!
  댓글 수: 2
Torsten
Torsten 2023년 8월 5일
What was z ?
And notice that your settings before
v_induced = u .* (1 + a_fit);
v_slipstream = u .* (1 + (2 .* a_fit));
are not used in the calculation of the two double integrals.
Yi-Kai Peng
Yi-Kai Peng 2023년 8월 5일
편집: Yi-Kai Peng 2023년 8월 5일
Hello Torsten,
yes I noticed that those two variables are not used in the calculation. Do you know any way to solve this problem? Also, z is the second integral that I want to integrate in azimuthal direction (0 to 2*pi).

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Torsten
Torsten 2023년 8월 5일
이동: Torsten 2023년 8월 5일
As written,
Oper.rho .* (v_induced ./ Oper.Vinf) .* 0.5 .* (Oper.Vinf^2 - (v_induced .^2));
and
Oper.rho .* (v_slipstream ./ Oper.Vinf) .* 0.5 .* ((v_slipstream - Oper.Vinf).^2);
are constant arrays of size 1x30 that do not depend on the formal integration parameters u and z.
So in principle, you integrate a constant vector over the rectangle [0, delta99] x [0, 2*pi].
I guess this is not what you want.
The error message stems from the fact that MATLAB expects a vector of the size of u and z as output from your function handle. But you always return the constant array of size 1x30.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by