Question

I'd like to create a Matlab plot of propeller angular velocity in terms of applied current. The point is, this requires combining two interdependent sets of data.

Firstly, drag coefficient c_d depends on angular velocity omega (I have no formula, just data) as seen on the plot below - the characteristics c_d(omega) could be easily linearised as c_d(omega) = p*omega + p_0.

Secondly, omega depends not only on applied current i, but also on the drag coefficient c_d(omega).

A script that solves the case, where c_d is constant below. It must be somehow possible to join those two using Matlab commands. Thanks for any help.

%%Lookup table for drag coefficient c_d
c_d_lookup = [248.9188579 0.036688351; %[\omega c_d]
    280.2300647 0.037199094;
    308.6091183 0.037199094;
    338.6636881 0.03779496;
    365.8908244 0.038305703;
    393.9557188 0.039156941;
    421.9158934 0.039667683;
    452.2846224 0.040348674;
    480.663676  0.041199911;
    511.032405  0.042051149;
    538.9925796 0.042561892;
    567.2669135 0.043242882;
    598.4734005 0.043668501;
    624.1297405 0.044264368;
    651.9851954 0.044604863;
    683.6105614 0.045200729];

subplot(2,1,1)
plot(c_d_lookup(:,1), c_d_lookup(:,2))
title('This is how c_d depends on \omega')
ylabel('c_d')
xlabel('\omega [rad/s]')



%%Calculate propeller angular speed in terms of applied current. omega
%%depends on c_d, which in turn depends on omega. The formula is:

% omega(i) = sqrt(a*i / (b * c_d(omega)))

% Where:
% i - applied current
% omega - propeller angular velocity
% a,b - coefficients

i = [1:15];
a = 0.0718;
b = 3.8589e-005;

%If c_d was constant, I'd do:
omega_i = sqrt(a .* i / (b * 0.042));

subplot(2,1,2)
plot(i, omega_i)
ylabel({'Propeller ang. vel.', '\omega [rad/s]'})
xlabel('Applied current i[A]')
title('Propeller angular velocity in terms of applied current')

enter image description here

EDIT:

Trying to follow bdecaf's solution. So I created a function c_d_find, like so:

function c_d = c_d_find(omega, c_d_lookup)
    c_d = interp1(c_d_lookup(:,1), c_d_lookup(:,2), omega, 'linear', 'extrap');
end

I don't know anything about Matlab function handles, but seem to understand the idea... In Matlab command window I typed:

f = @(omega) omega - sqrt(a .* i / (b * c_d_find(omega, c_d_lookup)))

which I hope created the correct function handle. What do I do next? Executing the below doesn't work:

>> omega_consistent = fzero(f,0)
??? Operands to the || and && operators must be convertible to logical scalar
values.

Error in ==> fzero at 333
    elseif ~isfinite(fx) || ~isreal(fx)
Was it helpful?

Solution

hmmm...

Wonder if I understand correctly - but looks like you are looking for a consistent solution.

Your equations don't look to complicated I would outline the solution like this:

  1. Write a function function c_d = c_d_find(omega) that does some interpolation or so
  2. make a function handle like f = @(omega) omega - sqrt(a .* i / (b * c_d_find(omega))) - this is zero for consistent omega
  3. calculate a consistent omega with omega_consistent =fzero(f,omega_0)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top