| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- # -*- coding: utf-8 -*-
- """
- Created on Tue Oct 26 17:53:54 2021
-
- @author: virgi
- """
- import numpy as np
- import math as ma
- len_seq = 10
- def creation_sin_RNN(len_seq,tmin,tmax,n,w,a=1,b=0):
-
-
- Datax, Datay = [], []
-
- t = np.linspace(tmin,tmax,n)
- x =a* np.sin(2*ma.pi*w*t)+b
- for i in range(len(x)-len_seq):
- Datax.append([x[i:i+len_seq]])
- Datay.append([x[i+1:i+len_seq+1]])
- Datax = np.array(Datax)
- Datay = np.array(Datay)
-
-
- return(Datax,Datay)
-
-
-
-
- def creation_x_sin_RNN(len_seq,tmin,tmax,n,w,a=1,b=1,c=0):
-
-
- Datax, Datay = [], []
-
- t = np.linspace(tmin,tmax,n)
- x=[]
- for i in t:
- x.append(a*i+b* np.sin(2*ma.pi*w*i)+c)
- for i in range(len(x)-len_seq):
- Datax.append([x[i:i+len_seq]])
- Datay.append([x[i+1:i+len_seq+1]])
- Datax = np.array(Datax)
- Datay = np.array(Datay)
-
-
- return(Datax,Datay)
-
- def creation_x_sin2_RNN(len_seq,tmin,tmax,n,w,a=1,b=1,c=0):
-
-
- Datax, Datay = [], []
-
- t = np.linspace(tmin,tmax,n)
- x=[]
- for i in t:
- x.append(a*i+b*np.sin(2*ma.pi*w*i)*np.sin(2*ma.pi*w*i)+c)
- for i in range(len(x)-len_seq):
- Datax.append([x[i:i+len_seq]])
- Datay.append([x[i+1:i+len_seq+1]])
- Datax = np.array(Datax)
- Datay = np.array(Datay)
-
-
- return(Datax,Datay)
-
-
-
-
- def creation_sin(tmin,tmax,n,w,a=1,c=0):
- Lx=[]
- t = np.linspace(tmin,tmax,n)
- for i in t:
- Lx.append(a*np.sin(w*i)+c)
-
- Lx=np.array(Lx)
- return(t,Lx)
-
- def creation_x_sin(tmin,tmax,n,w,a=1,b=0,c=0):
- Lx=[]
- t = np.linspace(tmin,tmax,n)
- for i in t:
- Lx.append(a*i+b* np.sin(2*ma.pi*w*i)+c)
- Lx=np.array(Lx)
- return(t,Lx)
-
- def creation_x_sin2(tmin,tmax,n,w,a=1,b=1,c=0):
- Lx=[]
- t = np.linspace(tmin,tmax,n)
- for i in t:
- Lx.append(a*i+b*np.sin(2*ma.pi*w*i)*np.sin(2*ma.pi*w*i)+c)
- Lx=np.array(Lx)
- return(t,Lx)
-
|