資源簡介
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開發-圖像傳輸
評論
共有 條評論