Skip to content

Instantly share code, notes, and snippets.

@mattgaidica
Created May 29, 2024 11:27
Show Gist options
  • Save mattgaidica/3a585ec6e44fefb9289b138b82e331cf to your computer and use it in GitHub Desktop.
Save mattgaidica/3a585ec6e44fefb9289b138b82e331cf to your computer and use it in GitHub Desktop.
Two models of innovation vs. funding.
% Parameters
num_points = 100;
noise_level = 0.25; % Adjust this value to control the amount of noise
% Generate x values
x_curve = linspace(0, 1, 1000); % Generate 1000 points between 0 and 1
y_curve = log(1 + 99 * x_curve) / log(100); % Compute y values for the curve
% Select 12 random points along the curve
indices = randperm(length(x_curve), num_points);
x_points = x_curve(indices);
y_points = y_curve(indices);
% Add noise to the points
x_noise = x_points + noise_level * (rand(size(x_points)) - 0.5);
y_noise = y_points + noise_level * (rand(size(y_points)) - 0.5);
% Plot the curve
close all;
figure('Position',[0,0,700,300]);
% Plot the scatter points
s = scatter(x_noise, y_noise, 'filled','MarkerFaceColor',repmat(0.8,[1,3]));
hold on;
plot(x_curve, y_curve, 'k', 'LineWidth', 5);
ylabel('Innovation');
xlabel('Funding');
set(gca,'fontSize',14);
title('Innovation vs. Funding','fontsize',18);
grid on;
ylim([0,1]);
xlim([0,1]);
xticks(xlim);
yticks(ylim);
set(gcf,'color','w');
% Generate x values
x = linspace(0, 1, 1000); % Generate 1000 points between 0 and 1
y = (exp(5 * x) - 1) / (exp(5) - 1); % Compute y values for the scaled exponential curve
plot(x, y, 'r:', 'LineWidth', 2);
legend({'Organization','Log Hypothesis','Exp Hypothesis'},'location','eastoutside');
exportgraphics(gcf,'logCurveNewsletter.png');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment