MATLAB: How to write equation in matlab ?

anonymous functionfringeimage processingImage Processing Toolboxsignal processing

equations and corresponding graph is given in attached file and i am trying like this but unable to find second graph where is wrong,, please help
%reflection function
s = @(x) (1-0.4*(cos(x/100))).*(0<=x & x<=511);
x = linspace(0, 500);
R = s(x);
figure(1)
plot(x,R)
axis([xlim 0 1.5])
% intensity function
f=1/20;
x = linspace(0, 500);
I=@(x) (R(x).*sin(2*pi*f*x));
plot(x,I)
axis([xlim 0 1.5])

Best Answer

I=@(x) s(x).*sin(2*pi*f*x);
plot(x,I(x))
Best wishes
Torsten.