How can I implement the following function block

1 Ansicht (letzte 30 Tage)
Brian Kiprono
Brian Kiprono am 2 Dez. 2022
Beantwortet: Eric Delgado am 3 Dez. 2022
I need to implement the function block shown. I used user defined function but ran into a few problems. variables are in a script/and workspace m and l. The u(i...) are inputs to the block. The error is that the variable is not defined as shown in 2nd image

Akzeptierte Antwort

Eric Delgado
Eric Delgado am 3 Dez. 2022
Just pass all the arguments to your function, not only the array "u".
function output = NameOfYourFunction(m, I, u)
arguments
m double = 1
I double = 2
u double = [45,45]
end
output = m * I * ( u(2)^2) * cos(u(1)) * sin(u(1));
end

Weitere Antworten (0)

Kategorien

Mehr zu Modeling finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by