Problem isolating and finding out a function maximum value
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lucas Resende
am 21 Nov. 2023
Beantwortet: Pratyush
am 21 Nov. 2023
Hello there. So, I'm having trouble trying to isolate three different functions and obtaining their maximum value. Bellow follows the script I've written, and the graph plotted with the functions I want to obtain the maximum amplitude (functions h, alpha, beta). I tried using Max(abs), but it did not work.
(A lot of lines before this)
% Nonlinear time-varying natural frequencies
omega=abs(compeigs(1:2:end,:));
% Nonlinear time-varying damping ratios
zeta=-real(compeigs(1:2:end,:))./omega;
figure(101)
h=plot(ti(tirange),omega/2/pi,ti(tirange([1 end])),[omega_lin omega_lin]/2/pi,'k--','linewidth',lw,'markersize',ms);
set(get(h(1),'parent'),'fontsize',fs);
xlabel('$t$ (s)')
ylabel('$\omega_n(t_0)$')
legend(h(1:4),{'$h$','$\alpha$','$\beta$','Linear'},'interpreter','latex')
xlim(ti(tirange([1 end])))
grid
figure(102)
h=plot(ti(tirange),zeta,ti(tirange([1 end])),[zeta_lin zeta_lin],'k--','linewidth',lw,'markersize',ms);
set(get(h(1),'parent'),'fontsize',fs);
xlabel('$t$')
ylabel('$\zeta(t_0)$')
legend(h(1:4),{'$h$','$\alpha$','$\beta$','Linear'},'interpreter','latex')
xlim(ti(tirange([1 end])))
grid
0 Kommentare
Akzeptierte Antwort
Pratyush
am 21 Nov. 2023
Hi Lucas,
I understand that you want to obtain the maximum amplitude of the functions you have ploted.
You could extract the values of the functions h, alpha, and beta where they are being defined in your code. After extracting the function values, you can use the "max" function in MATLAB to find the maximum value of each function.
Here's an example of how you might extract the function values and find their maximum values:
% Extracting function values
h_values = omega/2/pi; % Assuming omega/2/pi represents the function h
alpha_values = ...; % Extract values for the function alpha
beta_values = ...; % Extract values for the function beta
% Finding maximum values
max_h = max(abs(h_values));
max_alpha = max(abs(alpha_values));
max_beta = max(abs(beta_values));
Hope this helps.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!