Register to reply 
Defining piecewise function in matlab 
Share this thread: 
#1
Oct2710, 12:46 AM

P: 5

How would you write piecewise functions in matlab that can take vector inputs?
Here's a function that I'm trying to write.



#2
Nov310, 12:30 AM

P: 333

Try this to eliminate the problem at x=0.
g = @(x) 1.*(x==0) + (x~=0).*sin(x)./(x+(x==0)); t=[0 pi/2]; g(t) 


Register to reply 
Related Discussions  
MATLAB  piecewise defined Fn as periodic  Engineering, Comp Sci, & Technology Homework  1  
Defining implicit function given a parametric function  Calculus & Beyond Homework  1  
Finding constants in a piecewise function that allow the function to be differentiabl  Calculus & Beyond Homework  5  
We need help on piecewise function...  General Math  11  
Piecewise function  Calculus  1 