有关于地震动合成的主要参考书籍《地震工程学》,作者为胡聿贤。

其过程简述如下:
上面公式中:
该过程用流程图表示为:
以下代码使用进行求解,每一组随机数迭代100次,最大尝试20组随机数。
871function [atOutput,t] = S2TFFT(freqSeries,spectralSeries,dampRatio,scaleFactor,toleranceUpward,toleranceDownward,totalTime,risePeriod,stablePeriod,descendFactor)2% freqSeries:反应谱的频率向量3% SpectralSeries:反应谱的谱值向量4% dampRatio:阻尼比5% scaleFactor:谱值放大系数6% toleranceUpward:上偏差7% toleranceDownard:下偏差8% risePeriod:上升段9% stablePeriod:稳定段10% descendFactor:衰减系数11fmax=max(freqSeries(1),freqSeries(end));12fmin=min(freqSeries(1),freqSeries(end));13%% 采样频率14fsOrder=10^(floor(log10(fmax)));15fs=fmax/fsOrder;16fInt=[1,2,2.5,4,5,8];17for i=1:length(fInt)18 if fs<=fInt(i) 19 fs=fInt(i);20 break;21 end 22end23fs=2*fs*fsOrder;24if fs<5025 fs=50;26end27%% 合成参数28df=min(fmin/20,1/totalTime);29nf=fs/2/df;30nf=2^(nextpow2(nf));31nfft=2*nf;32df=fs/nfft;33T=1/df;34%% 反应谱转换功率谱35P=0.9; 36n1=floor(fmin/df);37n2=ceil(fmax/df);38freqs=n1*df:df:n2*df;39Sa=interp1(freqSeries,spectralSeries,freqs,'linear','extrap');40Aw=zeros(nf+1,1);41for i=n1+1:n2+142 Aw(i)=(2*dampRatio/(2*pi*pi*freqs(i-n1)))*Sa(i-n1)^2/(-2*log(-1*pi*log(P)/(2*pi*freqs(i-n1)*T)));43 Aw(i)=sqrt(4*Aw(i)*2*pi*df);44end45%% 包络线46[t,envelope]=GetEnvelope(fs,totalTime,risePeriod,stablePeriod,descendFactor);47%% 合成48for randomTimes=1:2049 % 随机相位50 phase=2*pi*rand(nf+1,1);51 phase(end)=0;52 phase(1)=0;53 phase=nfft*exp(phase*sqrt(-1));54 SseriesScaled=spectralSeries*scaleFactor;55 maxSseriesScaled=max(SseriesScaled);56 succeed=false;57 for cicles=1:10058 vecf=phase.*Aw;59 at=[vecf;flipud(conj(vecf(2:end-1)))];60 %逆变换合成时程61 at=ifft(at);62 %乘以非平稳包络线63 atOutput=at(1:length(t)).*envelope';64 % 求解反应谱65 Sat=tts(dampRatio,freqSeries,atOutput,1/fs);66 %计算上下偏差67 biasu=(Sat-SseriesScaled)/maxSseriesScaled;68 biasb=(Sat)./SseriesScaled;69 %如果偏差过大则调整傅里叶谱值70 if max(biasu)>toleranceUpward || min(biasb)<1-toleranceDownward71 blxs=SseriesScaled./Sat;72 xblxs=interp1(freqSeries,blxs,freqs,'linear','extrap');73 Aw(n1+1:n2+1)=Aw(n1+1:n2+1).*xblxs';74 else75 succeed=true;76 break;77 end78 end79 if succeed80 break;81 end82end83if ~succeed84 atOutput=[];85 t=[];86end87end