Function to find vertex of graph?
2 views (last 30 days)
Show older comments
clear; clc;
m = 2.5; % kg
k = 6e6; % N/m
c = 180; % N-s/m
r = 0:0.01:2;
Wn = sqrt(k/m) % rad/s
zeta = c / (2*sqrt(k*m))
omega = r * Wn;
imag1 = 1/k*(-2*zeta*r)./((1-r.^2).^2 + (2*zeta*r).^2);
figure(1)
plot (omega/(2*pi), imag1, 'k-') % r -> hz
xlabel('Frequency (Hz)')
ylabel('Im(G(W)) (m/N)')
grid on
I want to make a code that can find the x-coordinate and y-coordinate positions of the vertices at the bottom of the plot in the graph.
0 Comments
Accepted Answer
Dyuman Joshi
on 23 Apr 2023
m = 2.5; % kg
k = 6e6; % N/m
c = 180; % N-s/m
r = 0:0.01:2;
Wn = sqrt(k/m); % rad/s
zeta = c / (2*sqrt(k*m));
omega = (r * Wn)/(2*pi);
imag1 = 1/k*(-2*zeta*r)./((1-r.^2).^2 + (2*zeta*r).^2);
%Y Position of the vertex, i.e. Global minima
[ymin,idx] = min(imag1)
%Corresponding x value
xmin = omega(idx)
figure(1)
plot (omega, imag1, 'k-') % r -> hz
xlabel('Frequency (Hz)')
ylabel('Im(G(W)) (m/N)')
grid on
hold on
%plotting the vertex
plot(xmin,ymin,'r*')
More Answers (0)
See Also
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!