1

I am having an issue with the interaction of the Matlab function block in the Simulink with my model block. Below you can also find the picture. I have created a Matlab function with three inputs and 1 output. Since in the MatLab function block, I have solved a differential equation, it has complex expressions in the form of for example.

(exp(sqrt(-a/b)))

This generates the output of complex data types from the function block. When passing this to the integrator which is the input to my plant, I can not run the Simulink due to the error

    "Cannot pass the complex value to non-complex location"

I tried changing the data types of the integrator, then the same thing happens to other blocks in the Simulink. I also tried using absolute values, which of course gives real numbers, but turns out to be a very large number and generates high magnitude. I really need help in solving this issue. Can anyone help me in this/

Thanks in advance.

enter image description here

  • Are these building blocks supposed to be in the time domain or the s-domain? – A_A Jun 01 '20 at 10:05
  • they are in time domain. But I am wondering the logic behind this question?. Also, plant can be in the form of the transfer function. – Prateek Tiwari Jun 01 '20 at 10:20
  • The logic behind the question is to clarify if the model expects an s-plane type of variable to be passed around, or if it expects a single or vector of time domain values. Is it possible to talk a little bit more about what is in the plant or function block? Complex numbers are used to express phase differences. If you are passing around only 1 "thing" (time domain), then you are going to have to find a way of combining the two "things" ($\Re(z), \Im(z)$ for some $z$ variable) into one. – A_A Jun 01 '20 at 11:15

1 Answers1

1

The data type of the signal must be fixed in Simulink. Since you use a square root of a real signal, the output will be real if the data is positive, imaginary if negative. Simulink cannot allow that.

The workaround is to force your real signal to be a complex signal by setting its imaginary part to 0. Then feed the signal to the square root block. The output will always be complex.

Ben
  • 3,375
  • 1
  • 8
  • 16