(x) = 1 − e−4x 1 + e−4x using a suitable step size, plot this transfer characteristic over the range −2 ≤ x ≤ 2. plot the linear characteristic f(x) = x on the same axes in matlab

main.m
x = -2:0.01:2;

% Transfer characteristic
y = (1 - exp(-4*x)) ./ (1 + exp(-4*x));

% Linear characteristic
f = x;

% Plotting
plot(x, y, 'LineWidth', 2);
hold on;
plot(x, f, 'LineWidth', 2);
xlabel('x');
ylabel('f(x)');
legend('Transfer Characteristic', 'Linear Characteristic');
title('Transfer Characteristic vs Linear Characteristic');
339 chars
17 lines

gistlibby LogSnag