我想創建一個關於應用電流的螺旋槳角速度的Matlab圖。問題是,這需要結合兩個相互依賴的數據集。在Matlab中的非線性方程的交叉特性
首先,阻力系數c_d
取決於角速度omega
(I沒有式,只是數據)所看到下面的曲線圖 - 特性c_d(omega)
可以很容易地線性化作爲c_d(omega) = p*omega + p_0
。
其次,omega
不僅取決於應用電流i
,而且取決於阻力系數c_d(omega)
。
解決此案例的腳本,其中c_d
常數在下面。必須以某種方式使用Matlab命令將這兩者結合起來。謝謝你的幫助。
%%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')
編輯:
試圖跟隨bdecaf的解決方案。所以,我創建了一個功能c_d_find
,就像這樣:
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
我不知道任何關於Matlab的函數處理,但似乎明白的想法......在MATLAB命令窗口我輸入:
f = @(omega) omega - sqrt(a .* i/(b * c_d_find(omega, c_d_lookup)))
我希望創建正確的功能句柄。接下來我該做什麼?執行以下不工作:
>> 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)
所以,你要解決這個問題的'omega'或'i'一致的歐米伽?下面的圖表顯示了'C_d0'相對於'歐米茄'。上圖顯示了什麼?你最終想要繪製哪兩個值? – 2012-07-16 15:47:25
你說得對,問題不清楚 - 對不起。我重述了它,希望現在可以更容易回答。 – mmm 2012-07-17 08:18:19
我仍然不太關注你。根據施加的電流,你有螺旋槳角速度的情節,你錯過了什麼? – 2012-07-17 08:44:27