Why the the simulink Function block (Fcn) is giving me syntax error ????

3 vues (au cours des 30 derniers jours)
kamal kiki
kamal kiki le 28 Mai 2016
Hello every one.
In my Simulink model I am using a Function block (Fcn) having input from a mux block having 6 inputs. In the space of the Function block I wrote the expression:
u(1)*((1/(u(2)-1))+(1/2)*((u(3)/u(4))+1-cosd(u(5)*u(6))-((u(3)/u(4))^2-(sind(u(5)*u(6)))^2)^(1/2)))
When I run the simulation I had the message of a syntax error in the block of the Function (Fcn). So to check if all the parentheses in my expression are balanced, I copied the expression above in the command window and I have replaced u(1), u(2), u(3), u(4), u(5) and u(6) respectively by the numbers 1,2,3,4,5 and 6 and I obtained the expression below.
1*((1/(2-1))+(1/2)*((3/4)+1-cosd(5*6)-((3/4)^2-(sind(5*6))^2)^(1/2)))
When I hit enter the result was 1.1625 which shows that there is no errors in the writing of the expression.
When I have replaced the Function block (Fcn) by the interpreted Matlab function block and copied in it the same expression and gave to the inputs u(1),u(2),u(3),u(4),u(5), and u(6) the values of 1,2,3,4,5, and 6 I did not receive an error message but the result displayed in the display block was 2 which is wrong because different from the 1.1625 calculated in the command window.
Could anyone tell me how to solve my problem ????
Thanks in advance to everyone.

Réponses (0)

Catégories

En savoir plus sur Simulink Functions 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