# I need to plot the following script. But it gives an error.

1 view (last 30 days)
Ruslan Aslanov on 28 Nov 2021
Commented: Ruslan Aslanov on 28 Nov 2021
I think the problem is that we can't divide 1 by 0 so the column "Fw=1/(cos(w*Hs/Vs_soil));" gives an error.
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:5.4;
fn=(2*n+1)*f0;
%Magnification / Resonant frequency
w=2*pi*fn;
Fw=1/(cos(w*Hs/Vs_soil));
%Let's draw the magnification graph
plot(fn,Fw);
title('magnification graph');
xlabel('f(Hz)');
ylabel('magnification F(w)');
legend('Transfer Function');

VBBV on 28 Nov 2021
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:5.4;
fn=(2*n+1)*f0;
%Magnification / Resonant frequency
w=2*pi*fn;
Fw=1./(cos(w*Hs/Vs_soil));
%Let's draw the magnification graph
plot(fn,Fw);
title('magnification graph');
xlabel('f(Hz)');
ylabel('magnification F(w)');
legend('Transfer Function');
use the element wise matrix operator
Ruslan Aslanov on 28 Nov 2021
Thanks a lot

KALYAN ACHARJYA on 28 Nov 2021
Fw=1./(cos(w*Hs/Vs_soil));
Ruslan Aslanov on 28 Nov 2021
Thanks a lot

R2020a

### Community Treasure Hunt

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

Start Hunting!