# How can I represent the following piecewise function in Simulink

5 visualizaciones (últimos 30 días)
Idrak Karim el 29 de Feb. de 2020
Comentada: Walter Roberson el 8 de Abr. de 2021
Hello i need to represent a piecewise function in my simulink model that mirros the solution i got in matlab.
syms x
g= piecewise(0<=x<=0.0375, ((-10300/3)+((704000*x)/9)),0.0375<=x<=0.0625, -500, 0.0625<=x<=0.1,((39500/9)-(704000*x)/9));
fplot(g)
I am trying to use the matlab user defined function
function y = fcn(u)
if (u >= 0 && u <= 0.0375)
G= (-10300/3)+ ((704000*u)/9);
elseif (u >= 0.0375 && u<= 0.0625)
G= -500;
elseif (u >= 0.0625 && u<= 0.1)
G= (39500/9)-((704000*u)/9);
end
y = G;
with my input u, as a constant block with linspace(0,0.1), but it does not work. CAN SOMEONE PLEASE HELP ME URGENTLY. NEED IT ASAP FOR MY DISSERTATION.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Priyanshu Mishra el 4 de Mzo. de 2020
Hi Idrak,
You may refer to this link for using MATLAB function.
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Walter Roberson el 8 de Abr. de 2021

Iniciar sesión para comentar.

### Categorías

Más información sobre Assumptions en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by