| # -*- 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(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(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(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) |