how can I do an integration window of a signal both in MATLAB and Simulink?

6 views (last 30 days)
Hi all,
I'm developing a Stochastic Knock Control and need to do an integration window of the in-cylinder pressure signal for a window of a 40 crank angle degrees. Any idea?
Also, I need to obtain the maximum amplitude of the signal within that integration window.
Many thanks!

Accepted Answer

Andy L
Andy L on 7 Aug 2014
Hi Jorge.
Have you considered running your simulink model from a MATLAB function, using the function sim. You can set up your parameters in your function (make sure to write them in your simulink model too) and using to workspace blocks these will be passed back into the function workspace. You can then use these variables to plot onto a figure, find a max value etc.
I hope this helps.
  5 Comments
Jorge
Jorge on 8 Aug 2014
I've got the in-cylinder pressure in a spreadsheet excel file and it's from test data. I need to process this signal and then it will be run in my Knock Control Model in MATLAB/Simulink. Is it answer your questions?
Andy L
Andy L on 8 Aug 2014
Yes - I would look to structure your project in the following way:
  1. Import the data from Excel into MATLAB - xlsread will help with this.
  2. Pre process your data using MATLAB to prepare it for your simulink model.
  3. Run your Simulink Model from MATLAB as mentioned above.
  4. Post-Process your model outputs that have been passed back into your MATLAB function.
  5. Any plotting saving etc can be done.

Sign in to comment.

More Answers (1)

Jorge
Jorge on 8 Aug 2014
I wouldn't say it better :)
In that structure I don't know how to process the in-cylinder pressure signal to obtain the knock intensity.
I saw some example such as the use of an amplifier, bandpass, absolute value and integrator, but I don't know how to code that and if it is a good signal processing.
Have you got any idea?
  3 Comments
Jorge
Jorge on 12 Aug 2014
Edited: Jorge on 12 Aug 2014
I think FFT are slower in a real time simulation. I tried a bandpass filter and it seems that the signal is well filtered:
a=xlsread('Mini_With_Knock.xlsx','A2:A430')
b=xlsread('Mini_With_Knock.xlsx','B2:B430')
plot(a,b)
hold on
d = fdesign.bandpass('Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2',1e3,2e3,20e3,21e3,40,1,40,48e3);
Hd = design(d,'equiripple');
Hd.PersistentMemory = true; fvtool(Hd);
y = filter(Hd,b);
abs=abs(y)
max=max(abs) plot(a,y);
Unfortunately, in my University there is nobody who can help me with this. Indeed, I'm doing this project with a company and you can imagine how it works...they are always busy.
What do you mean with knock gains? Should I add gain to the signal response?
Andy L
Andy L on 12 Aug 2014
In Frequency domain the output (level) is typically gain (dB) vs Frequency - I'm assuming that specific frequencies above a specific gain threshold are how you are identifying knock?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!