Can you explain to me the last part of this code? Thanks in advance!
2 ビュー (過去 30 日間)
古いコメントを表示
close all
clear all
%properties of rocks
Vs_soil=170;
Psoil=1.5;
Hs=70;
Vs_rock=1000;
Prock=2.4;
damp=0;
%impedance ratio
IC=((Prock*Vs_rock)/(Psoil*Vs_soil));
%Ground fundamental frequency
f0=Vs_soil/(4*Hs);
%Maximum magnification for one dimensional monolayer
A0=1/((1/IC)+0.5*pi*damp);
%harmonic frequencies
d=10;
dx=1/d;
n=-0.5:dx:8;
fn=(2*n+1)*f0;
%Magnification / Resonant frequency
% I didn't get this part of the code after "a=cos(w*Hs/Vs_soil)". Why are " round, isinf " used here?
w=2*pi*fn;
a=cos(w*Hs/Vs_soil);
y=roundn(a,-4);
Fw=1./abs(y);
Fw(isinf(Fw))=A0;
%Let's draw the magnification graph
plot(fn,Fw);
title('magnification graph');
xlabel('f(Hz)');
ylabel('Magnification F(w)');
legend('Transfer Function');
grid;
print -djpeg magnification graph
0 件のコメント
採用された回答
Voss
2021 年 11 月 30 日
y=roundn(a,-4);
rounds a to the nearest multiple of 10^-4 and stores the result in y.
Fw(isinf(Fw))=A0;
replaces elements of Fw that are Inf or -Inf with A0.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!