How to find a constant input variable in a summation?
Show older comments
Basically I'm trying to reverse a loop summation to find the constant variable to make the final summation Q=0. See the attached code. I've tried running fzero() function, but I always get an error to about an undefined input argument 'Ohm_r', which is actually the variable I'm needing to find. All other constants have been defined.
function Q = rpm_read(Ohm_r)
for i=2:21;
N(i)=i-1; %number of blade elements
r(i)= (R/n)*(i-1); %radius of blade element, m
dr(i) = r(i)-r(i-1);
Ut(i) = Ohm_r*r(i); %in plane velocity, m/s
Up(i) = Vd_conv; %Vertical descent velocity, m/s
RV(i) = sqrt((Ut(i))^2+(Up(i))^2); %Resultant velocity using pyth. thm., m/s
Phi(i) = atan(Up(i)/Ut(i)); %inflow angle, rad
Phi_d(i) = radtodeg(Phi(i)); %(deg)
AoA(i) = Phi(i)+PA_r; %inflow plus pitch angle (rad), angle of attack
AoA_d(i)= radtodeg(AoA(i)); %(deg)
q(i) = (1/2)*rho_a*RV(i)^2; % dynamic pressure, Pa
Cl(i)=-4e-5*(AoA_d(i))^6+0.001*(AoA_d(i))^5-0.008*(AoA_d(i))^4+...
0.042*(AoA_d(i))^3-0.124*(AoA_d(i))^2+0.297*(AoA_d(i))+0.022;
Cd(i)=-4e-6*(AoA_d(i))^4+9e-5*(AoA_d(i))^3+0.020;
dLx(i) = q(i)*Cl(i)*c*sin(Phi(i))*dr(i);
dDx(i) = q(i)*Cd(i)*c*cos(Phi(i))*dr(i);
dQ(i) = (dLx(i)-dDx(i))*r(i)*numb;
end
Q = sum(dQ);
end
In the main function I'm calling this by [rpm fval exitflag output]= fzero('rpm_read',x0,options)
Does everything I have so far look correct? Is it even possible to reverse an iteration to find the input variable?
Answers (0)
Categories
Find more on Optimization Toolbox 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!