Iterative calculation of control signal by UDF and undefined variable error

3 visualizaciones (últimos 30 días)
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.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by