Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different results with different runs on same dataset #4

Open
Astik-2002 opened this issue Jun 20, 2024 · 0 comments
Open

Different results with different runs on same dataset #4

Astik-2002 opened this issue Jun 20, 2024 · 0 comments

Comments

@Astik-2002
Copy link

Astik-2002 commented Jun 20, 2024

Greetings. I'm using AircraftIden for system identification of a multirotor system. I'm using data from a csv file. Upon running the code below:
`import sys

sys.path.insert(0, '../')

from AircraftIden import FreqIdenSIMO, TransferFunctionFit, TransferFunctionParamModel
from AircraftIden.TransferFunctionFit import plot_fitter
import matplotlib.pyplot as plt
import numpy as np
import csv
import sympy as sp
import math

def siso_freq_iden(win_num=32):
#with open('/home/astik/Downloads/arducopter_sysid_data/axis_10_RATE_nohead.csv', 'r') as f:
with open('/home/astik/Downloads/arducopter_sysid_data/bill_sid_axis1_nohead.csv', 'r') as f:
reader = csv.reader(f)
data = list(reader)
arr = np.array(data)
arr = np.array(data, dtype=float)
#save_data_list = ["running_time", "yoke_pitch", "theta", "airspeed", "q", "aoa", "VVI", "alt"]
#arr = np.load("../data/sweep_data_2017_11_16_11_47.npy")
time_seq_source = arr[:, 1]
rout_source = arr[:, 23]
gx_source = arr[:, 4]*math.pi / 180
simo_iden = FreqIdenSIMO(time_seq_source,0.5, 50, rout_source, gx_source, win_num=None)

plt.rc("figure", figsize=(15,10))
plt.figure("rout->r")
simo_iden.plt_bode_plot(0)

#plt.plot(time_seq_source, gx_source, color="red")



freq, H, gamma2, gxx, gxy, gyy = simo_iden.get_freq_iden(0)
a, b, c, d, e, f, g, tau, s = sp.symbols("a b c d e f g tau s")
num = f*s*s
den = a*s*s*s*s + b*s*s*s + c*s*s + d*s + e
tfpm = TransferFunctionParamModel(num, den, tau)
fitter = TransferFunctionFit(freq, H, gamma2, tfpm, nw=20, iter_times=300, reg = 0.1)
tf = fitter.estimate(2, 20, accept_J=50)
plot_fitter(fitter, "$rout -> p$")
plt.show()

if name == "main":
siso_freq_iden(128)

`
I'm getting different results for the same dataset, each time I run the code. Each time, the transfer functions are slightly different, depending on the final fit. Can you share the reason for this, and how to make transfer function estimation more repeatable?
I've added the csv dataset and the results I'm getting below

sysid_results.zip
bill_sid_axis1_nohead.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant