%% Train Covariate Survival Model
% Load training data.

load('covariateData.mat')

%
% This data contains battery discharge times and related covariate information. The covariate variables are:
% Temperature
% Load
% Manufacturer
% The manufacturer information is a categorical variable that must be encoded.
% Create a covariate survival model.

mdl = covariateSurvivalModel;

%
% Train the survival model using the training data, specifying the life time variable, data variables, and encoded variable. There is no censor variable for this training data.

fit(mdl,covariateData,"DischargeTime",["Temperature","Load","Manufacturer"],[],"Manufacturer")

% Plot the baseline survival function for the model.

plot(mdl)

% Copyright 2012 The MathWorks, Inc.