声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 711|回复: 0

[综合讨论] 大家帮我看看这个程序做了个啥,谢谢

[复制链接]
发表于 2009-5-18 21:44 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
%This program is for observing power spectral density
format long
Nfft=2^10;
omega=0.1;
A=0.1;
gamma=0.1;
PT=2.0*pi/omega;
M=Nfft; %the mumber of discrete points in esch period
dt=PT/M;
N=20;
NM=50;
D=0.2;
x0=1.0;
for i=1:1:N*M
    R=rand(2,1);
    gw=(-4*D*dt*dt*log(R(1,1)))^0.5*cos(2.0*pi*R(2,1));
    t=(i-1)*dt;
    x=x0+(x0*(1+A*cos(omega*t))-x0^3.0)*dt+gw;
    x0=x;
end

Fs=1.0/(8*dt);%define the sampling frequency
P=zeros(Nfft/2+1,1);%initialize
for kk=1:1:NM
    disp('1=,kk=')
    kk
    XX=zeros(Nfft,1);
    k=0;
    for i=1:1:8*M;
        R=rand(2,1);
        gw=(-4*D*dt*log(R(1,1)))^0.5*cos(2.0*pi*R(2,1));
        t=(i-1)*dt;
        x=x0+(x0*(1+A*cos(omega*t))-x0^3.0)*dt+gw;
        if (mod(i,8)==0)
            k=k+1;
            TT(k,1)=t;
            XX(k,1)=x;
        end
        x0=x;
    end
    [Pxx,F]=psd(XX,Nfft,Fs);
    P=P+Pxx;
end
P=P./NM;
plot(F(1:40),P(1:40))
回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-22 11:29 , Processed in 0.054735 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表