# Untitled

unknown
matlab
a month ago
1.1 kB
2
Indexable
Never
% Given Data
X = 1:30;
Y = [51, 49, 40, 34, 33, 28, 29, 29, 25, 26, 24, 24, 23, 26, 23, 26, 24, 23, 24, 23, 24, 23, 25, 23, 25, 24, 23, 23, 24, 23];

% Constants
Xsp = 10; % Standard quantity
Ysp = Y(Xsp); % Unit time per unit at the standard quantity
n1 = 0.3; % Initial logarithmic slope at the first unit (you may need to adjust this value)
nsp = 0.2; % Logarithmic slope at the standard quantity (you may need to adjust this value)

% Equations
syms C D
eq2 = log(Ysp) == log(Y(1)) - n1*log(Xsp) + C*(log(Xsp))^2 + D*(log(Xsp))^3;
eq3 = nsp == n1 + 2*C*log(Xsp) + 3*D*(log(Xsp))^2;
sol = solve([eq2, eq3], [C, D]);

% Calculating Y values for the cubic model
logY_cubic = log(Y(1)) - n1*log(X) + sol.C*(log(X)).^2 + sol.D*(log(X)).^3;
Y_cubic = exp(logY_cubic);

% Plotting the learning curve
figure;
plot(X, Y, 'o', 'MarkerFaceColor', 'b');
hold on;
plot(X, Y_cubic, 'r-', 'LineWidth', 2);
xlabel('Unit Number (X)');
ylabel('Unit Time to Complete (Y)');
title('Learning Curve of the Cubic Model');
legend('Actual Data', 'Cubic Model');
grid on;
hold off;