Clear Filters
Clear Filters

Fsolve error with vertcat

2 views (last 30 days)
Innocente Andrea Contalbo
Hello, I have tried to run this code but I get a vertcat error. The goal is to solve a system of 2 non linear vectorial equations by using fsolve and finding 'vi' and 'a'.
%% Data
R=5.5;
n=1000;
drdr=1/n;
drdr=0.1:drdr:1;
dr=R/n;
r=R*drdr;
c=0.3;
rho=1.225;
theta_0=0.2618; %collective pitch [rad]
theta_twist=0.0349; %[rad]
theta_r=theta_0 + r.*theta_twist; %[rad]
b=4;
V_tip=205;
Omega=V_tip/R; % [rad/s]
Vc=5;
%% Swirl
phi_swirl=@(vi,a) atan((vi + Vc)./((1-a).*Omega.*r));
U=@(vi,a) sqrt(((1-a).*Omega.*r).^2 + (vi + Vc).^2);
alpha_swirl=@(vi,a) theta_r - atan((vi + Vc)./((1-a).*Omega.*r));
G_swirl=@(vi,a) 2./pi.*acos(exp(-b./2.*(1-drdr)./(drdr.*(atan((vi+Vc)./(((1-a).*Omega.*r)))))));
F_swirl1=@(vi,a) 0.5.*b.*rho.*U(vi,a).^2.*2.*pi.*alpha_swirl(vi,a).*cos(phi_swirl(vi,a)).*c.*dr ...
-4.*pi.*rho.*r.*vi.*(vi+Vc).*G_swirl(vi,a).*dr;
F_swirl2= @(vi,a) 0.5.*b.*rho.*U(vi,a).^2.*(2.*pi.*alpha_swirl(vi,a).*sin(phi_swirl(vi,a))+cdr.*cos(phi_swirl(vi,a))).*c.*r.*dr...
-4.*pi.*Omega.*a.*(vi+Vc).*r.^3.*dr;
F_swirl=@(vi,a) [F_swirl1;F_swirl2];
Initialguess=[zeros(1,numel(drdr));zeros(1,numel(drdr))];
vi_a=fsolve(F_swirl,Initialguess);
The error is the following. Any idea to solve it?
Error using vertcat
Nonscalar arrays of function handles are not allowed; use cell arrays instead.
Error in Untitled2>@(vi,a)[F_swirl1;F_swirl2]
Error in fsolve (line 242)
fuser = feval(funfcn{3},x,varargin{:});
Error in Untitled2 (line 32)
vi_a=fsolve(F_swirl,Initialguess);
Caused by:
Failure in initial objective function evaluation. FSOLVE cannot continue.

Answers (0)

Categories

Find more on Systems of Nonlinear Equations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!