In the code below   "rect" for rectangular function is not working. Please give me a way to implement rectangular function in matlab.....

wx=0.1; %rect x half-width (m)

wy=0.05; %rect y half-width (m)

L=2; %side length x&y (m)

M=200; %samples/side length

dx=L/M; %sample interval (m)

x=-L/2:dx:L/2-dx; %x coordinates

y=x; %y coordinates

[X,Y]=meshgrid(x,y); %X and Y grid coords

g=rect(X/(2*wx)).*rect(Y/(2*wy));

Similar questions and discussions