Note that there are some explanatory texts on larger screens.

plurals
  1. POCross characteristics of a non-linear equation in Matlab
    text
    copied!<p>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. </p> <p>Firstly, drag coefficient <code>c_d</code> depends on angular velocity <code>omega</code> (I have no formula, just data) as seen on the plot below - the characteristics <code>c_d(omega)</code> could be easily linearised as <code>c_d(omega) = p*omega + p_0</code>.</p> <p>Secondly, <code>omega</code> depends not only on applied current <code>i</code>, but also on the drag coefficient <code>c_d(omega)</code>.</p> <p>A script that solves the case, where <code>c_d</code> is constant below. It must be somehow possible to join those two using Matlab commands. Thanks for any help.</p> <pre><code>%%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') </code></pre> <p><img src="https://i.stack.imgur.com/7oB7B.png" alt="enter image description here"></p> <p><strong>EDIT:</strong></p> <p>Trying to follow <strong>bdecaf's</strong> solution. So I created a function <code>c_d_find</code>, like so:</p> <pre><code>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 </code></pre> <p>I don't know anything about Matlab function handles, but seem to understand the idea... In Matlab command window I typed:</p> <pre><code>f = @(omega) omega - sqrt(a .* i / (b * c_d_find(omega, c_d_lookup))) </code></pre> <p>which I hope created the correct function handle. What do I do next? Executing the below doesn't work:</p> <pre><code>&gt;&gt; omega_consistent = fzero(f,0) ??? Operands to the || and &amp;&amp; operators must be convertible to logical scalar values. Error in ==&gt; fzero at 333 elseif ~isfinite(fx) || ~isreal(fx) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload