From: Behzad Jazizadeh on
here is my code:

***************************
% Omega = 1;
k = 100;
c = 5;
e0 = 5;
eR = 8.85 * 10^(-12);
h = 0.0015;
V = 1;
% M = [1:990];
Am = 1;
A = 0.10 * 0.06;
% for t=1:5000,
% x = Am * sin(Omega * t);
% xd = diff(x)./diff(t);
% end
% F = k * x + c * xd + e0 * eR * A * (V^2) / ((h - x)^2);
% plot(F);
for Omega = 1 : 1 : 100
for t = 0 : 1 : 1000
x = sin(Omega .* t);
xd = Omega * cos(Omega * t);
F = k * x + c * xd + e0 * eR * A * (V.^2) ./ ((h - x).^2);
end
M = max(F);

end
Omega = 1:1:100;
plot(Omega,M);
***********************************

I wanted to excite the system with x and get time response as F...but then after that I wanted to get a frequency (Omega) sweep and find the Maximum of F and plot all the Max values versus Omega...so sort of a transfer function but numerical.

could someone please help me with it? I think I need to store all the max values somewhere then draw them...right?