MATLAB: Plotting of transfer functions

digital image processingimage analysisimage processingimage segmentationMATLAB

Sir, I drew the graph below, but I could not do the above. I'll be glad if you take a look.
Below graph:
A = 60;
B = 160;
%Setting up the figure%
X_Position = 100;
Y_Position = 100;
Width = 1200;
Height = 300;
figure('Position', [X_Position Y_Position Width Height])
%Case a)%
r = (0:256);
r(r > A & r < B) = 0;
s = r;
subplot(1,3,1); plot(s,'LineWidth',2);
title("Option a)")
xlabel("r"); ylabel("T(r)");

Best Answer

Try this
A = 60;
B = 160;
%Setting up the figure%
X_Position = 100;
Y_Position = 100;
Width = 1200;
Height = 300;
figure('Position', [X_Position Y_Position Width Height])
%Case a)%
r = (0:256);
r(r > A & r < B) = 0;
s = r;
subplot(1,3,1); plot(s,'LineWidth',2);
title("Option a)")
xlabel("r"); ylabel("T(r)");
r = (0:256);
s = zeros(size(r));
s(r > A & r < B) = 250;
subplot(1,3,2); plot(s,'LineWidth',2);
title("Option b)")
xlabel("r"); ylabel("T(r)");
Related Question