BVP unknown parameter 2 column vector

1 vue (au cours des 30 derniers jours)
Omer
Omer le 13 Avr 2025
Commenté : Omer le 13 Avr 2025
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 commentaire
Omer
Omer le 13 Avr 2025
Error using bvparguments
Error in calling BVP4C(ODEFUN,BCFUN,SOLINIT,P1,P2...):
The derivative function ODEFUN should return a column vector of length 2.

Connectez-vous pour commenter.

Réponse acceptée

Torsten
Torsten le 13 Avr 2025
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
  1 commentaire
Omer
Omer le 13 Avr 2025
I express my gratitude to you.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Animation dans Help Center et File Exchange

Produits


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by