Hi Johnny,
MATLAB provides a function "fitclinear" that you can use to fit a logistic regression model. You can also specify the loss function, in your case, "logit".
Here is an example code for the same, where I have generated 100 samples for each class and labeled the data as "+1" and "1" for the two classes:
The "Learner", "logistic" argument specifies that we are using a logistic regression model.
The "LossFun", "logit" argument specifies that we are using the logistic loss function.
numSamples = 100;
X = [randn(numSamples, 2) + 1; randn(numSamples, 2) - 1]; % Features
y = [ones(numSamples, 1); -ones(numSamples, 1)]; % Output Binary labels: +1 and -1
% Plot the synthetic data
figure;
gscatter(X(:,1), X(:,2), y, 'rb', 'xo');
xlabel('Feature 1');
ylabel('Feature 2');
title('Synthetic Data');
legend('Class +1', 'Class -1');
grid on;
% Fit a Model using Logistic Loss
mdl = fitclinear(X, y, 'Learner', 'logistic', 'LossFun', 'logit');
disp(mdl);
For more information, you can refer to the following documentation link: