EZyRB icon indicating copy to clipboard operation
EZyRB copied to clipboard

help!!! Sinusoidal vibration analysis use in ezyrb

Open YuDe95 opened this issue 9 months ago • 5 comments

The objective Finite Element Analysis of a Sinusoidal Excitation,i want to use it to predict the result when Frequency changes .

Already tried tests sanpshot has 3 diffrent frequency[2,5,10]node num is 306 time iteration 101 so the snapshot shape is 303306. params shape is [3032] value is [[ 0. 2. ] [ 0.01 2. ] ...... [ 1. 2. ] [ 0. 5. ] [ 0.01 5. ] [ 0.02 5. ] [ 0.03 5. ] ...... [ 1. 5. ] [ 0. 10. ] [ 0.01 10. ] [ 0.02 10. ] [ 0.03 10. ] ...... [ 1. 10. ]] origin data when node id is 7 the picture is as follow

Image when i predit the frequece is 4 the picture is as follow

Image

code as follow:


#np.save('paramsTest.npy', params_data)
#np.save('x_data.npy', x_data)
params_data = np.load(r'params_data')
x_data = np.load(r'x_data')
times_i = np.load(r'times_i.npy')
db = Database(params_data, x_data)
print("POD")
pod = POD("svd")
# rbf = RBF(kernel="linear")
rbf = RBF(kernel="inverse_multiquadric",epsilon=1)
# rbf = RBF()


rom = ROM(db, pod, rbf)
print("rom.fit()")
rom.fit()
print("predict")
predict_data = []
for i in range(101):
    times_i[i]
    predict_params=[]
    predict_params.append(times_i[i])
    predict_params.append(4)
# res = rom.predict(new_param).snapshots_matrix
    res = rom.predict(predict_params).snapshots_matrix
    predict_data.append(res[0,6])

import matplotlib.pyplot as plt

plt.figure(figsize=(12, 8))
# plt.plot(times_i,x_data[0:101,6], label='X Component')
plt.plot(times_i,predict_data, label='X Component')
plt.title(f' - X Component Acceleration')
plt.xlabel('Time')
plt.ylabel('Acceleration')
plt.legend()
plt.grid(True)
plt.show(block=True)

YuDe95 avatar Mar 04 '25 10:03 YuDe95

Dear @YuDe95, I don't have completely understood the problem with your code. Are you obtaining an error, or the model shows a poor accuracy?

ndem0 avatar Mar 12 '25 16:03 ndem0

the model shows a poor accuracy. Simply put, I want to predict a new vibration sine curve based on frequency and amplitude, but the result I output using this library is not a sine curve but a linear curve

YuDe95 avatar Mar 13 '25 01:03 YuDe95

If I understand it right, you are trying to predict a sinus of one frequency, based on sines of different frequencies. That is never going to work well, because sines of different frequencies don’t linearly combine into a new clean sine wave. Mathematically speaking, the result you are trying to get is not in the space of basis functions you have, because sine functions of different frequencies are orthogonal.

flabowski avatar Mar 14 '25 11:03 flabowski

you are right.do you know how to solve it?

YuDe95 avatar Mar 14 '25 11:03 YuDe95