0

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)
mmm
  • 1,277
  • 5
  • 18
  • 34
  • So you want to solve this for `omega` or `i`? The lower graph shows `C_d0` with respect to `omega`. What does the upper graph show? What two values do you want to plot eventually? – Eitan T Jul 16 '12 at 15:47
  • You're right, the question was unclear - sorry for that. I rephrased it, hopefully it's going to be easier to answer now. – mmm Jul 17 '12 at 08:18
  • I'm still not quite following you. You have the plot of propeller angular velocity in terms of applied current, what are you missing? – Eitan T Jul 17 '12 at 08:44
  • Yes, but the plot of angular velocity in terms of applied current has been done assuming `c_d(omega) = 0.042` was constant, which it isn't (see the first plot). I'd like `omega(i)` to reflect that. – mmm Jul 17 '12 at 08:47
  • oh - and your c_d_find has more inputs - so you need to adjust the function handle. – bdecaf Jul 17 '12 at 09:37
  • nope, changed that already :). The handle itself works and returns a vector. – mmm Jul 17 '12 at 09:43
  • Surprised me. But the problem is you need to search for each `i` separately. Use `f = @(omega) omega - sqrt(a * i(1) / (b * c_d_find(omega, c_d_lookup)))` – bdecaf Jul 17 '12 at 09:54

1 Answers1

1

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)
bdecaf
  • 4,652
  • 23
  • 44
  • Thank you bdecaf, I edited my question. I think there is really little missing now. – mmm Jul 17 '12 at 09:13
  • oh - that's simple - omega_0 is just the start value for optimization. Just put a reasonable value there. – bdecaf Jul 17 '12 at 09:16
  • Edited the question, still there seems to be a problem. – mmm Jul 17 '12 at 09:37
  • Thanks bdecaf. I ended up programming a loop, but the results are correct - that's what matters. – mmm Jul 17 '12 at 10:12