MATLAB: How to write code for 2D image using code for one dimensional plot given below

digital image processingimage analysisimage processingimage segmentationMATLABsignal processing

a = 0.1;
T = 20;
s = @(x) (2*a*x/T) .* (0<=x & x<=T/2) + (2*a*(1-x/T)) .* (T/2<=x & x<=T);
x = linspace(0, 20);
sv = s(x);
figure(1)
plot(x,sv)
hold on
for k1 = 20:20:60
plot((x+k1),sv)
end
hold off

Best Answer

I am still not certain what you want.
See if this works:
a = 0.1;
T = 20;
s = @(x) (2*a*x/T) .* (0<=x & x<=T/2) + (2*a*(1-x/T)) .* (T/2<=x & x<=T);
x = linspace(0, 20);
X = repmat(x, 80, 4);
sv = s(X);
figure(1)
imagesc(0:size(X,1)-1, 1:size(X,2), sv)
set(gca, 'YTick',[])