plot amplitude curves with variables f, k, and a range of c values, for a frequency range of 0.5<r<1.5 in matlab

You can use the following Matlab code to plot the amplitude curves:

main.m
f = 0.5:0.01:1.5; % frequency range
k = 1; % constant
c_range = 1:0.1:2; % range of c values
amp = zeros(length(c_range),length(f)); % initialize amplitude matrix

% loop through c values
for i = 1:length(c_range)
    c = c_range(i);
    amp(i,:) = a./(sqrt((k-m.*f.^2).^2+(c.*f).^2)); % calculate amplitude
end

% plot amplitude curves
figure
plot(f,amp)
xlabel('Frequency')
ylabel('Amplitude')
legend(num2str(c_range'))
422 chars
18 lines

Note that in the code above, I assumed that you already have the value of a and m defined somewhere in your code. You may need to adjust the code to match your specific use case.

gistlibby LogSnag