I am new to MATHLAB Simulink so I do not know how to code the MATLAB Function. Is what I do correct or wrong. I wanted to insert equation in the MATHLAB Function. Thank you so much for your help. Really apreciate it.

 Réponse acceptée

MATLAB uses () for indexing. So u(1) not u[1]
I cannot read what is on line 3. It sort of looks like it might be
y = t;
if so it would be a problem because t is not defined.
The y that is being calculated on line 2 is a scalar, and it not obvious why you would want to transform it on line 3... it might be more clear if we could read the line.

3 commentaires

Hello sir thank you for the reply. Sorry for the inconvenience. Here is the full screenshot.
your u appears to have at least two elements. When you assign y=u then all of the elements are copied to y. Because that is the first assignment to the variable, Simulink understands that you are doing that assignment in order to set the size and datatype of y.
Then after that you assign a scalar to the y that you just told Simulink is the same size as u.
You attempt to use [] for indexing but MATLAB and Simulink never use [] for indexing. As I indicated earlier use u(1) not u[1]
Alright thanks for the help.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Produits

Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by