假设我有一个时间序列t,其中有100次测量,每个条目代表每天的测量值。我假设信号中存在一些周期性-可能每天,每周或每月重复一次。
将时间序列转换为傅立叶域可能有助于找到这样的周期性?
如何使用numpy的fft模块查找时间序列中最可能的时间段?
我有一个函数d\xcf\x86/dt = \xce\xb3 - F(\xcf\x86)(其中F(\xcf\x86)-- a 是2\xcf\x80周期函数)和该函数的图形F(\xcf\x86)。
我需要创建一个程序,输出 6 个\xcf\x86(t)不同值\xce\xb3( \xce\xb3 = 0.1、0.5、0.95、1.05、2、5)和 的图t\xe2\x88\x88[0,100]。
这是函数的定义F(\xcf\x86):
-\xcf\x86/a - \xcf\x80/a, if \xcf\x86 \xe2\x88\x88 [-\xcf\x80, -\xcf\x80 + a]\n -1, if \xcf\x86 \xe2\x88\x88 [-\xcf\x80 + a, - a] \nF(\xcf\x86) = \xcf\x86/a, if \xcf\x86 \xe2\x88\x88 [- a, a]\n 1, if \xcf\x86 \xe2\x88\x88 [a, \xcf\x80 - …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个定期的workmanager脚本,但它只是在我打开应用程序时运行它只运行一次(不是定期的)!
这是我的主要活动:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_work);
Intent intent = new Intent();
PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this,0,intent,0);
NotifyWorker.pendingIntent = pendingIntent;
NotifyWorker.context = this;
PeriodicWorkRequest periodicWorkRequest = new PeriodicWorkRequest.Builder(NotifyWorker.class, 1, TimeUnit.MINUTES).build();
WorkManager.getInstance().enqueue(periodicWorkRequest);
}
Run Code Online (Sandbox Code Playgroud)
}
这是我的dowork方法:
public Result doWork() {
Log.i("wd","wd");
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context,"ctx")
.setSmallIcon(R.mipmap.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(context.getResources(),R.mipmap.ic_launcher))
.setSmallIcon(R.drawable.logo)
.setContentTitle("Title")
.setContentText("Desc")
.setContentIntent(pendingIntent);
android.app.NotificationManager notificationManager =
(android.app.NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0 , notificationBuilder.build());
return Result.SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)
为什么它不是每1分钟运行一次?我想念的是什么?