How do I assign a complex value into a non-complex location?

I have the following code that will calculate the rotation of a motor based upon an input flux and temperature. The function is being run in Simulink, but I keep getting the error "Cannot assign a complex value into a non-complex location" at the last line in the function (that actually calculates Theta). I can see that theta may be complex due to the feedback loop that was built around the temperature T, but I don't see how to solve it. I have attached a picture of the simulink model as well.
Thanks,
Greg
function Theta = flow_rate(Q,T)
%Calc theta position
Theta=complex(0);
Ti=600; %constant inlet particle temperature (degree C)
%Convert the output of the servo motor (theta) to linear distance, assumes
%3000 counts per turn
slot_length=1.16;% m
%Heat Transfer Model
Cp=1200; %specific heat of the particles
%beverloo Constants and parameters
C1=19;
C2=8.9;
rho_b=2000; %bulk density, kg/m^3
d_p=0.35e-3;%particle diameter, 350 micron
g=9.81; %gravity
Theta=((Q/(C1*rho_b*sqrt(g)*slot_length*Cp*(T-Ti)))^(2/3)+C2*d_p)*3000;

4 件のコメント

Archit Yadav
Archit Yadav 2019 年 4 月 24 日
Did you get any solution to this problem?
Prateek Tiwari
Prateek Tiwari 2020 年 5 月 29 日
Even I am looking for the answer to this question.
Sergey Kasyanov
Sergey Kasyanov 2020 年 8 月 17 日
The same problem.
David Goodmanson
David Goodmanson 2020 年 8 月 17 日
For function inputs Q and T, there are going to be problems when Q and (T-Ti) are of opposite sign. Is there any explicit or implied way to prevent this, prior to the function call?

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSpecialized Power Systems についてさらに検索

質問済み:

2017 年 12 月 6 日

コメント済み:

2020 年 8 月 17 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by