CWT design in simulink

15 views (last 30 days)
vinod naidu
vinod naidu on 25 May 2016
Commented: Ahmad Aldiab on 17 Apr 2024 at 11:46
my motivation for using the simulink is it supports particular hardware package , as per my project i have a sound signals which will give the output frequency peaks when CWTFT applied using CWT tools and I have tried to convert my implemented matlab code to C/C++ using code gen while converting the function and sub functions are too many (32 sub-fn's for scl2frq ) and unsupported syntax like "try" "catch" i switched to simulink design , How would i design scl2frq, morl ,cwt functions blocks for simulation in matlab if i design my code in simulink the entire design would support for C code gen ?
  1 Comment
Ahmad Aldiab
Ahmad Aldiab on 17 Apr 2024 at 11:46
is it possible to share your model please, thanks a lot

Sign in to comment.

Answers (2)

Paramonte
Paramonte on 10 May 2018
Did you get any reply? Also interested
  2 Comments
NIKOLAY YAKOVENKO
NIKOLAY YAKOVENKO on 29 Nov 2021
This is probably too old thread, but I think I solved this. I do use full blown codegen including the embedded coder. When try to use CWT withing Simulink like a Matlab Function block subsystem, the Simulink tells that CWT is not supported for codegen. And it gives you a hint saying: "use CWTFILTERBANK instead". So I used that, it will define cwtfilterbank structure, which I pass to another function called wavelets(), and that function will generate the whole set of wavelets as per parameter given, i.e. for the script below it will generate 57 wavelets:
fb = cwtfilterbank('SignalLength',100,'SamplingFrequency',10,'WaveletParameters',[3,9]);
[psi, freq]=wavelets(fb);
So now we've got wavelets. The further path of your activity will depend on your task. If you have a finite chunk of signal for example in the file of 100 samples, and you need to get answer, which of wavelets (frequencies)
correlates to that chunk the most, you use cross correlator (xcorr) simulink block from DSP toolkit. The xcorr for 100 samples of signal and 100 samples of wavelets length will produce 199 samples vector of correlation output, and max() on that vector will give you the answer for each wavelet.
My task was to use continuous sliding cwt(), for indefinite length of the signal, so xcorr was not a good fit, i needed something else that will multiply and accumulate 100 samples of signal against each wavelets 100 samples, sample rate times per second. The suitable block either can be done in simulink subsystem, or Matlab function subsystem. I used the ready solution -- the DSP toolkit Discrete FIR Filter block. The only issue with that it does not support multiple sets of coefficients (matrix) so I reversed inputs, i.e. put the wavelet samples as a signal input (which supports matrix input), and the signal to coefficient input of the block.
The approach worked, it generated the correct embedded code.
Leila Farahani
Leila Farahani on 11 Jun 2023
I should find instantenous frequency of a signal with cwt in simulink, whats your suggestion for my problem?
do you have any simulink model that helps me?

Sign in to comment.


NIKOLAY YAKOVENKO
NIKOLAY YAKOVENKO on 9 Feb 2023
Edited: NIKOLAY YAKOVENKO on 9 Feb 2023
I use my own CWT block in SImulink that calculates a running CWT for set of my constructed family of wavelets made of Fractional derivatives of the Gaussian function. I use it in embedded system with Simulink code generator to C language.
https://www.mathworks.com/matlabcentral/answers/38849-harmonic-analysis-using-wavelet#answer_1167710

Products

Community Treasure Hunt

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

Start Hunting!