matlab - How do i program this function switch in simulink? -


i trying make switching function simulink function block. , faulty:

function y  = switch(soc,input,launch,charge,a) %#codegen y = a; if ((launch == 1), (soc ~= input))     y = charge; else     y = a; end 

i want output y same unless launch 1 , soc different input, in case want y = charge. block takes care of comparing soc , input driving charge current.

how modify code correct switching. addon y = charge should hold until soc = input , reset y = a;

i guess want:

function y  = switch(soc,input,launch,charge,a) %#codegen y = a; if (launch == 1) && (soc ~= input)     y = charge; else     y = a; end 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -