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

1 次查看(过去 30 天)
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
VBBV 2021-11-28
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

更多回答(1 个)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021-11-28
Fw=1./(cos(w*Hs/Vs_soil));

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by