Effacer les filtres
Effacer les filtres

Simulink embedded function detects phantom complex value

10 vues (au cours des 30 derniers jours)
Victor
Victor le 10 Fév 2012
Commenté : DURODOLA Taiwo le 5 Août 2019
I have an embedded function block in my Simulink model containing a natural log function that calculates an output value based on inputs that go in the numerator or denominator of the log. When I run the simulation, an error message pops up saying that I'm trying to take the log of a complex value. I am constantly tracking the values that go inside this function and none of them are approaching zero or a very high number, but I still keep getting an error. What do you think could be the problem?
  1 commentaire
Kaustubha Govind
Kaustubha Govind le 10 Fév 2012
Have you tried setting a breakpoint in the function and stepping through?

Connectez-vous pour commenter.

Réponses (3)

Umar Farooq
Umar Farooq le 7 Déc 2016
I want to simulate wind generation model in simulink. i connected a bus with the output "m" of the wind generator to collect voltage and current and further connected a scope to see the results. when i try to run the simulation i get this error
Complex signal mismatch. Output port 1 of 'wind/Signal Specification1' is a signal of numeric type complex. However, it is driving a signal of numeric type real
Kindly help me with this.

Walter Roberson
Walter Roberson le 11 Fév 2012
Modifié(e) : Walter Roberson le 31 Juil 2019
That message could potentially mean that the inherited signal type for that signal is marked as complex, because it resulted from a sequence of steps that could potentially produce complex values for some arguments and constants (even if it is never possible in with the arguments and constants that you are using.)
Just to throw out an example: arccos "could" produce complex outputs if you happened to feed it values outside of -1 to 1. You might know for other reasons that your inputs were always in that range, but Simulink might not have been able to establish that with the information it had and the proof algorithms it uses.
If this is the problem, that the signal type is marked as complex, then I gather there are two possible solutions: pass the signal through a block that Simulink knows selects only the real part, Or instead of inheriting the signal type, force it to real (preferably back at the output stage of whatever Simulink is thinking could create the complex value.)
(I have never used Simulink myself, but there was a question with this resolution perhaps 7 or 8 months ago and the solution lurked in my memory.)
  3 commentaires
zunaira
zunaira le 31 Jan 2013
Can you please share the solution ,as I am encountering with same problem? Thanking you in advance
DURODOLA Taiwo
DURODOLA Taiwo le 5 Août 2019
Thanks Mr Roberson;
But which block can i can i employ to force the complex output value to a real value.
Thanks, God bless.
You may however, help review the model. It's attached herewith

Connectez-vous pour commenter.


DURODOLA Taiwo
DURODOLA Taiwo le 31 Juil 2019
Please find above the attached file. i wil appreciate if solution id proffered

Catégories

En savoir plus sur Prepare Model Inputs and Outputs dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by