Skip to content
Permalink
d2e428c722
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
16 lines (13 sloc) 876 Bytes
%--------- Challenger_cost_logistic.m ---------------------------
%The purpose of the script is to accept the O-ring data, and run it through
%a cost analysis that will also output a plot of the best fit model for
%part failures.
%--- Compile data from Challenger O-ring file -----------
challenger = [53,1;57,1;58,1;63,1;66,0;66.8,0;67,0;67.2,0;68,0;69,0;69.8,1;69.8,0;70.2,0;70.2,0;72,0;73,0;75,0;75,1;75.8,0;76.2,0;78,0;79,0;81,0];
x = challenger(:,1); % Independent variable x assigned to temperature
y = challenger(:,2); % Dependent variable y assigned to status
% Set options for fminunc
options = optimset('GradObj', 'on', 'MaxIter', 400);
% Run fminunc to obtain the optimal theta
% This function will return theta and the cost
[theta, cost] = fminunc(@(a)(cost_logisticV3(a, x,y)), [20 -3]); %Output the cost and gradient of data and graph and values of theta.