close all; clear; clc

choice = input("Choose a spring (1, 2, or 3): ");
switch choice
    case 1
        k = 0.05;
    case 2
        k = 0.2;
    case 3
        k = 3;
    otherwise
        disp("Error: invalid choice")
        return
end

choice = input("Choose a mass (1 or 2): ");
switch choice
    case 1
        m = 0.6;
    case 2
        m = 4;
    otherwise
        disp("Error: invalid choice")
        return
end

wn = natural_frequency(k, m);
fprintf("Natural frequency: %d Hz\n", wn)

function wn = natural_frequency(k, m)
    wn = sqrt(k / m);
    wn = wn / (2 * pi);
end