MATLAB.3 Periodic Functions We say f(x) is periodic with period m if f(x)=f(x+m) for all x. Usually we are given a formula for f on a single period [a,b) with b-a=m. To find f(x) for x not in [a,b) we first find the greatest integer multiple of m less than or equal to x-a , z=m*floor((x-a)/m) (Here floor(t) is the MATLAB function giving the greatest integer <=t.) Now y=x-z is in [a,b). The point is that f(y)=f(x) and we have a formula for f(y). example Let f(x)=abs(x) for -3<=x<3 and assume f(x) is 3-(-3)=6 -periodic. To write a M-file for f type : ************************************************************* function w=f(x) z=6*floor((x+3)/6); y=x-z; w=abs(y); ************************************************************* ASSIGNMENT 3 : 1. Let f(x)=x^2 if-2<=x<2 and f(x) is 4-periodic. Write f.m and graph f(x) on [-10,10]. 2. Let g(x)=x if -2<=x<2 and g(x) is 4-periodic . Write g.m and graph g(x) on [-10,10] .