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
2019-4-24
Did you get any solution to this problem?
Prateek Tiwari
2020-5-29
Even I am looking for the answer to this question.
Sergey Kasyanov
2020-8-17
The same problem.
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 Exchange 中查找有关 Language Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!