How to find roots of a polynomial equation in simulink using matlab function

4 views (last 30 days)
Hi, I am trying to find the value of T in the equation:
log10(Psat) = (- 2.18) + (2.95(e-2)*T) - (9.18e(-5)*T^2) + (1.44e(-7)*T^3)
I am using matlab function to find the value of T using log10(Psat)+2.18 as the value of u,
In the matlab function , I am writing code as
function y = fcn(u)
y = roots([1.44*exp(-7),-9.18*exp(-5),2.95*exp(-2),-u]);
I am attaching the simulink block also. I am getting an error as " Data 'y' is inferred as a variable size matrix, while its properties in the Model Explorer specify its size as inherited or fixed. Please check the 'Variable Size' check box and specify the upper bounds in the size field."
Also, as it is a polynomial function of order 3, we will get three values of T (1 real and 2 complex), How to display the real value only and to use it further in the model.
Please help me with the same. Thanks in advance

Answers (0)


Find more on Polynomials in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by