Iterative calculation of control signal by UDF and undefined variable error

조회 수: 1 (최근 30일)
Emre Zengin
Emre Zengin 2015년 5월 23일
편집: Emre Zengin 2015년 5월 23일
There are two main problems about my simulation.
The first one is, eventhough I assign values to variables in my user defined function, I get the error below:
"Undefined function or variable 'var_name'. The first assignment to a local variable determines its class."
I solved it by equating the variables which are to be updated to zero and since my updated value is what I need, I have no problems about it. However, it doesn't seem to me that, this is an effective solution for this problem. What would you recommend?
Secondly,I don't think I successfully feed the last value of my variables to generate next values of them. Please, see the block, which is named "pid". Could you please check if the structure I use is right or wrong. If it is wrong, is there another way of performing this task?
Feel free to use the following info to initialize the simulation.
err = [0 0 0]
w1 = rand(1)*ones(1,3)
w2 = rand(1)*ones(1,3)
w3 =rand(1)*ones(1,3)
I = [0 0 0]
ctrl = 0
Thanks in advancce, Best regards.

답변 (0개)

카테고리

Help CenterFile Exchange에서 PID Controller Tuning에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by