资源简介
matlab开发-记录文件的绘图仪加速度、速度、位移和频率内容。绘制记录文件的加速度、速度、位移和频率内容。
代码片段和文件信息
%
% This code open an Earthquake acceleration record
% then plot acceleration velocity displacement
% and frequency content of this record.
%
% ------------------------------------------------
%
% By: Mostafa Fathi Sepahvand
% Ph.D. Candidate in Structural Engineering
%
% e-Mail: mostafa_fathi_s@yahoo.com
%% Initialization
clc clear close all
% Ground acceleration
g=980.6; % cm/s^2
% Open Earthquake record file
% This record file downloaded from PEER‘s site and then
% 4 first lines (that are record charachteries) are removed.
filename=‘elcentro.txt‘;
a=load(filename);
a=reshape(a‘1[]).*g;
NumPoints=numel(a);
% Time step (delta T)
DT=0.01; % sec
% Time vector
t=(1:NumPoints)*DT;
%% Acceleration Velocity and Displacement
% Compute velocity and displacement of earthquake record
% by means of cumulative trapezoidal integration scheme
v=cumtrapz(ta);
u=cumtrapz(tv);
% These two above codes are equivalent to following codes:
% v = cumsum(mean([a(1:end-1); a(2:end)]))*DT; v = [0 v];
% u = cumsum(mean([v(1:end-1); v(2:end)]))*DT; u = [0 u];
% Plot Acceleration Velocity and Displacement of Earthquake record
subplot(311) plot(t a) title(‘Acceleration‘) ylabel(‘cm/s^2‘)
subplot(312) plot(t v) title(‘Velocity‘) ylabel(‘cm/s‘)
subplot(313) plot(t u) title(‘Displacement‘) ylabel(‘cm‘)
% save to text file
atout=[t‘ a‘]; save(‘at.txt‘ ‘atout‘ ‘-ascii‘)
vtout=[t‘ v‘]; save(‘vt.txt‘ ‘vtout‘ ‘-ascii‘)
utout=[t‘ u‘]; save(‘ut.txt‘ ‘atout‘ ‘-ascii‘)
%% Frequency content
omega = 0.1:0.05:100; % rad/sec
NumOmega = numel(omega);
Fs = zeros(1 NumOmega);
for i = 1:NumOmega
ca = sum(cos(omega(i).*t).*a)*DT;
cb = sum(sin(omega(i).*t).*a)*DT;
Fs(i) = (ca^2+cb^2)^0.5;
end
figure
plot(omega Fs)
title(‘Frequency content of El-Centro Earthquake‘)
xlabel(‘\omega (rad/sec)‘‘fontsize‘10‘fontweight‘‘b‘)
ylabel(‘Acc. (cm/s^2)‘‘fontsize‘10‘fontweight‘‘b‘)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1997 2016-01-04 17:54 earthquake.m
文件 61600 2015-11-10 03:58 elcentro.txt
文件 1323 2016-01-03 17:33 license.txt
- 上一篇:matlab开发-动态系统中的故障检测和隔离
- 下一篇:matlab开发-图像传输
相关资源
- matlab开发-永磁同步电机PMSM动态数学模
- matlab开发-多目标优化差分进化算法
- matlab开发-随机微分方程解算
- matlab开发-波长调制光谱的二次谐波模
- matlab开发-仿制药生物生理学基础药动
- matlab开发-使用svmrfe选择功能
- matlab开发-KDTreeNearestNeighborandRangeSear
- matlab开发-stlread
- matlab开发-三维图像堆栈查看器
- matlab开发-动态电压恢复器故障dvr
- matlab开发-数据处理的分组方法GMDH
- matlab开发-DVR
- matlab开发-ParetoSet
- matlab开发-ShamirsSecretSharing
- matlab开发-othellom
- matlab开发-EMGONOFF
- matlab开发-级联H桥多电平转换三相
- matlab开发-带图形用户界面的步进电机
- matlab开发-MFTireGUI
- matlab开发-自适应霍夫曼编码技术字符
- matlab开发-ConnectFour
- matlab开发-floodfillscanline
- matlab开发-Paretosurfacenavigator
- matlab开发-分步序达尔文粒子群优化
- matlab开发-改进的解决方案经济调度方
- matlab开发-为Resnet50网络设计工具箱模
- matlab开发-sigmoid
- matlab开发-同步发电机的详细模型,包
- matlab开发-多层反向传播神经网络
- matlab开发-Parrotminirones的模拟支持包
评论
共有 条评论