Function to find vertex of graph?

18 Ansichten (letzte 30 Tage)
Jungil
Jungil am 23 Apr. 2023
Kommentiert: Jungil am 23 Apr. 2023
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.

Akzeptierte Antwort

Dyuman Joshi
Dyuman Joshi am 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)
ymin = -3.5861e-06
idx = 101
%Corresponding x value
xmin = omega(idx)
xmin = 246.5618
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*')

Weitere Antworten (0)

Tags

Produkte


Version

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by