Simulate a non linear system from input and output signals
Show older comments
My system is non linear. There is some harmonics in the output signal. Using this code i cant replicate my output signal. Simulated signal does not contain harmonics. How can i change the code?
clear all;close all;clc;
[inpSig,fs]=audioread('varFsin_1K.wav');
[outSig, Fs] = audioread('AliELENvarFsin_1K261104b500_8_23.wav');
windowLength = 256;
win = hamming(windowLength,"periodic");
overlap = round(0.75 * windowLength);
ffTLength = windowLength;
Ts=1;
data = iddata(outSig,inpSig,Ts)
nx = 10;
sys = ssest(data,nx);
compare(data,sys)
dt = 1/Fs;
t=0:dt:(length(inpSig)*dt)-dt;
z=lsim(sys,inpSig,t)
spectrogram(z,win,overlap,ffTLength,Fs,'yaxis');
Answers (1)
Ayush
on 29 Aug 2023
Hi @suniya vs
To replicate the harmonics in your output signal using the provided code, you can try the following steps:
- Increase the model complexity:
nx = 15;
sys = ssest(data, nx);
- Adjust the window length and overlap: Increasing the window length and reducing the overlap can provide a higher resolution spectrogram.
windowLength = 512; % Increase the window length
overlap = round(0.5 * windowLength); % Reduce the overlap
- Adjust the spectrogram parameters: Increasing ffTLength can provide a higher frequency resolution.
ffTLength = 1024; % Increase the FFT length
You may read further from here:
- https://in.mathworks.com/help/ident/ref/ssest.html
- https://in.mathworks.com/help/signal/ref/spectrogram.html
Thanks,
Ayush Jaiswal
Categories
Find more on Linear Model Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!