Skip to content

Instantly share code, notes, and snippets.

@robotsorcerer
Created June 10, 2021 13:05
Show Gist options
  • Save robotsorcerer/07333714a3f15ce1728d0ec6225c41a5 to your computer and use it in GitHub Desktop.
Save robotsorcerer/07333714a3f15ce1728d0ec6225c41a5 to your computer and use it in GitHub Desktop.
A visualization of class-kappa functions
%% Class Kappa functions
% alpha = arctan(r) is a class kappa function
clc; close all
r = linspace(1, 1000);
alpha = atan(r);
subplot(221)
plot(alpha, 'LineWidth',3); hold on;
grid on;
xlabel('r'); ylabel('\alpha=tan^{-1}(r)')
title('Class \kappa function')
legend('\alpha=tan^{-1}(r)')
% class kappa infinity
r = linspace(0, 1, 100);
c=.5;
alpha = r.^c;
subplot(222)
plot(alpha, 'LineWidth',3); hold on;
plot(min(r, r.^2), 'r--', 'LineWidth', 2.5)
grid on;
xlabel('r'); ylabel('\alpha=r^c; c>0')
title('Class \kappa_\infty functions')
legend('\alpha=r^c; c>0', 'min(r, r^2)', location='southeast')
% class kappa L functions
s = 2; % fix s
k = 5.0;
beta = r./(k*s*r+1);
subplot(223)
plot(beta, 'LineWidth', 3); hold on; grid on
% fix r;
s = r;
r = .25;
beta = r./(k*s*r+1);
plot(beta, 'r--', 'LineWidth', 2.5); hold on
ylabel('\beta(r, s)= r/(ksr+1)')
title('Class \kappa L function: \beta = r/(ksr+1)')
legend('Variable r, fixed s; \beta=Class \kappa',...
'Variable s, fixed r; \beta is strictly decreasing in s')
% class kappa L functions
subplot(224)
r = linspace(0.1,0.2)
s = .001; % fix s
c = 2;
beta = (r.^c).*exp(-s);
plot(beta, 'LineWidth', 3); hold on; grid on
% fix r;
s = r;
r = .25;
beta = (r.^c).*exp(-s);
plot((beta), 'r--', 'LineWidth', 2.5); hold on
ylabel('\beta(r, s)= r^c e^{-s};')
title('Class \kappa L function: \beta = r^c e^{-s}')
legend('Variable r, fixed s; \beta=Class \kappa',...
'Variable s, fixed r; \beta is strictly decreasing in s',...
'location', 'best')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment