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

Did you get any solution to this problem?
Even I am looking for the answer to this question.
The same problem.
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 Exchange에서 Specialized 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