BVP unknown parameter 2 column vector

5 次查看(过去 30 天)
Dear friends, Can you help me to run the code below? I tried many things but I couldn't succeed.
clear all
clc
close all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global aoa_rbar aoa_r c C_L0 GJ e
% GIVEN PARAMETERS
GJ= 76.6; %Nm^2
c=0.15; %m
x_ac=0.0375; %m
x_0=0.075; %m
d=0.0; %m
L=0.6; %m
W= 11.919; %N/m
rho=1.225; %kg/m^3
aoa_r= 3*0.0174533; %rad
C_Mac=0;
C_L0=0;
C_L_aoa=4.8074; % 1/rad
N=1;
e=x_0-x_ac;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SOLUTION B.2)
q_b2=1500;
aoa_rbar=0;
solinit_b2=bvpinit(linspace(0,L,100),@guess,q_b2);
sol_b2=bvp4c(@theta_b2,@bc_b2,solinit_b2);
%% FUNC B.2 )
function dthetady_b2=theta_b2(y,theta,q_b2)
global c GJ C_L_aoa e aoa_rbar aoa_r
lamda_sq_b2=q_b2*c*C_L_aoa*e/GJ;
dthetady_b2=[theta(2) ;-lamda_sq_b2*(theta(1)+aoa_r+aoa_rbar)];
dthetady_b2=dthetady_b2(:);
end
% Initial guess function
function yinit_b2 = guess(x)
yinit_b2 = [0; 0.01];
end
function output_b2=bc_b2(theta_a,theta_b,q_b2)
output_b2=[theta_a(1) ;theta_b(2); theta_b(1)-10000];
end
  1 个评论
Omer
Omer 2025-4-13
Error using bvparguments
Error in calling BVP4C(ODEFUN,BCFUN,SOLINIT,P1,P2...):
The derivative function ODEFUN should return a column vector of length 2.

请先登录,再进行评论。

采纳的回答

Torsten
Torsten 2025-4-13
You forgot to include "C_L_aoa" as global variable in the script part of your code.
clear all
clc
close all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global aoa_rbar aoa_r c C_L0 GJ e C_L_aoa
% GIVEN PARAMETERS
GJ= 76.6; %Nm^2
c=0.15; %m
x_ac=0.0375; %m
x_0=0.075; %m
d=0.0; %m
L=0.6; %m
W= 11.919; %N/m
rho=1.225; %kg/m^3
aoa_r= 3*0.0174533; %rad
C_Mac=0;
C_L0=0;
C_L_aoa=4.8074; % 1/rad
N=1;
e=x_0-x_ac;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SOLUTION B.2)
q_b2=1500;
aoa_rbar=0;
solinit_b2=bvpinit(linspace(0,L,100),@guess,q_b2);
sol_b2=bvp4c(@theta_b2,@bc_b2,solinit_b2);
plot(sol_b2.x,sol_b2.y)
grid on
%% FUNC B.2 )
function dthetady_b2=theta_b2(y,theta,q_b2)
global c GJ C_L_aoa e aoa_rbar aoa_r
lamda_sq_b2=q_b2*c*C_L_aoa*e/GJ;
dthetady_b2=[theta(2) ;-lamda_sq_b2*(theta(1)+aoa_r+aoa_rbar)];
dthetady_b2=dthetady_b2(:);
end
% Initial guess function
function yinit_b2 = guess(x)
yinit_b2 = [0; 0.01];
end
function output_b2=bc_b2(theta_a,theta_b,q_b2)
output_b2=[theta_a(1) ;theta_b(2); theta_b(1)-10000];
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Animation 的更多信息

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by