フィルターのクリア

Problem isolating and finding out a function maximum value

1 回表示 (過去 30 日間)
Lucas Resende
Lucas Resende 2023 年 11 月 21 日
回答済み: Pratyush 2023 年 11 月 21 日
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

採用された回答

Pratyush
Pratyush 2023 年 11 月 21 日
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 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by