Integrate with two dependent variables and solve a system

Hello all!
I will try to explain my problem:
I have two equations and two unknowns "w" and "T". One of the equations is an integral from a to b relative to a variable "r". The integral equation contains two terms that are function of both "w" and "r" and this term calls a value on a interpolated plot. Those terms are defined as Cd and Cl.
The equations are the following, knowing that:
  • mult_Cl = CL(-((atan(20/(pi*r)) - pi/18) - atan(w/(omega*r)))*180/pi)* omega*r/(sqrt(omega.^2*r.^2+w.^2));
  • mult_Cd = CD(-((atan(20/(pi*r)) - pi/18) - atan(w/(omega*r)))*180/pi)* omega*r/(sqrt(omega.^2*r.^2+w.^2));
and
  • CL and CD are interpolated functions
T = integral ( rho/2*(omega.^2*r^2 + w.^2)* ( 4 - 2.35294*(r/50 - 0.1)) *( mult_Cl + mult_Cd ),5,50);
T = 2*pi*rho*R.^2*(Vinf - w)*w
----
Where rho, omega, Vinf are known values
I need to solve both T equations at the same time to find a value of "w" for both.
I have never tried that before, so I am kinda lost. Thank you very much!!

Réponses (1)

Use MATLAB's fzero on the function
f=@(w)integral ( rho/2*(omega.^2*r^2 + w.^2)* ( 4 - 2.35294*(r/50 - 0.1)) *( mult_Cl + mult_Cd ),5,50) - 2*pi*rho*R.^2*(Vinf - w)*w
to get w.
Then insert in one of the above equations to get T.
Best wishes
Torsten.

4 commentaires

Hello Torsten, thank you for your answer!
I tried and got the following error
Error using fzero (line 288)
FZERO cannot continue because user-supplied function_handle ==> @(w)integral(rho/2*(omega.^2*r.^2+w.^2)*(4-2.35294*(r/50-0.1))*(CL(-((atan(20./(pi*r))-pi/18)-atan(w./(omega*r)))*180./pi)*omega*r./(sqrt(omega.^2*r.^2+w.^2))+CD(-((atan(20./(pi*r))-pi/18)-atan(w./(omega*r)))*180./pi)*omega*r./(sqrt(omega.^2*r.^2+w.^2))),5,50)-2*pi*rho*R.^2*(Vinf-w)*w failed with the error below.
Inner matrix dimensions must agree.
Below is the code I have so far. Once again, thanks for the help!
clc; clear all; close all;
%%read Cl and Cd from excel sheet
Y = xlsread('NACA_23012.xlsx');
Separate values
AOA = Y(:,1);
Cl = Y(:,2);
Cd = Y(:,5);
%Cl interpolation
figure(1)
x=AOA;
y=Cl;
xi = -90:0.1:90;
CL = interp1(x,y,xi);
plot(AOA,Cl,'o',xi,CL)
%Cd interpolation
figure(2)
CD = interp1(AOA,Cd,xi);
plot(AOA,Cd,'o',xi,CD)
Parameters
R = 50;
R_cutout = 0.1*R;
r = R_cutout:0.1:R;
c = 4 - 2.35294*(r/50 - 0.1);
%plot blade
figure(3)
plot(r,3/4*c,r,1/4*c)
ylim([-10 10])
plot twited blade
theta = atan(20./(pi.*r)) - pi./18;
figure(4)
plot(r,(3/4).*c.*cos(theta),r,(1/4).*c.*cos(theta))
ylim([-10 10])
% mult_Cl = CL(-((atan(20./(pi*r)) - pi/18) - atan(w./(omega*r)))*180./pi)* omega*r./(sqrt(omega.^2*r.^2+w.^2));
% mult_Cd = CD(-((atan(20./(pi*r)) - pi/18) - atan(w./(omega*r)))*180./pi)* omega*r./(sqrt(omega.^2*r.^2+w.^2));
R = 50;
R_cutout = 0.1*R;
omega = 2*pi/3;
rho = 1.225;
Vinf = 22;
f=@(w)integral ( rho/2*(omega.^2*r.^2 + w.^2)* ( 4 - 2.35294*(r/50 - 0.1)) *( CL(-((atan(20./(pi*r)) - pi/18) - atan(w./(omega*r)))*180./pi)* omega*r./(sqrt(omega.^2*r.^2+w.^2)) + CD(-((atan(20./(pi*r)) - pi/18) - atan(w./(omega*r)))*180./pi)* omega*r./(sqrt(omega.^2*r.^2+w.^2)) ),5,50) - 2*pi*rho*R.^2*(Vinf - w)*w;
Z = fzero(f,1)
CL and CD are arrays, not functions.
So CL(-atan...) and CD(-atan...) does not make sense to me.
Best wishes
Torsten.
You are right!
Now CL and CD are functions of x, but now the error I get is
FZERO cannot continue because user-supplied function_handle ==> @(w)integral(rho./2.*(omega.^2.*r.^2+w.^2).*(4-2.35294.*(r./50-0.1)).*(CL(-((atan(20./(pi.*r))-pi./18)-atan(w./(omega.*r))).*180./pi).*omega.*r./(sqrt(omega.^2.*r.^2+w.^2))+CD(-((atan(20./(pi.*r))-pi./18)-atan(w./(omega.*r))).*180./pi).*omega.*r./(sqrt(omega.^2.*r.^2+w.^2))),5,50)-2.*pi.*rho.*R.^2.*(Vinf-w).*w failed with the error below.
First input argument must be a function handle.
The first argument to "integral" must be a function handle, not an expression.
Best wishes
Torsten.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Function Creation dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by