Matlab function help in simulink model

i want to write this function in Matlab Function Box
{
function y = func_name(a)
b=b+a;
y=b;
}
the error is b is not defined
Actually I want write code for integration and derivative block

 Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 19 de Ag. de 2013
Editada: Azzi Abdelmalek el 19 de Ag. de 2013
function y = func_name(a)
persistent b
if isempty(b)
b=0;
end
b=b+a;
y=b;
Look at persistent

3 comentarios

Pramit Biswas
Pramit Biswas el 19 de Ag. de 2013
thank you very much for this quick and very helpful reply
can you help me to code this two block
Azzi Abdelmalek
Azzi Abdelmalek el 19 de Ag. de 2013
Why do you want to code those blocks?
Pramit Biswas
Pramit Biswas el 20 de Ag. de 2013
1. Learn: How matlab works, what actually happen on this block? logic/math to program in real time; I know that integration can be written as summation. but that theory not works on real time/simulation mode
2. I want to take "to the power" of the signal:Derivative^variable1

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Modeling en Centro de ayuda y File Exchange.

Productos

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by