Thread Subject:
S Functions or Matlab function blocks

Subject: S Functions or Matlab function blocks

From: Aravind VJ

Date: 15 Jul, 2012 11:34:27

Message: 1 of 2

Hello

I am an electronics engineer. Interested in using simulink. I am trying to do FFT inside an S function block (I am new to simulink, but have some experience with matlab). Somone please guide me on this

Regards
Aravind

Subject: S Functions or Matlab function blocks

From: Phil Goddard

Date: 15 Jul, 2012 14:00:07

Message: 2 of 2

There is an FFT block in the Signal Processing Blockset is you have access to it.

Otherwise you could use either a MATLAB Fcn block or an S-Function.

Assuming the input signal is sample based (i.e. scalar at each time step), then the first thing you need to do is buffer the signal into an appropriate length vector before performing the fft.
Within an S-function you'd do that with a DWork vector.
Within a MATLAB Fcn block you'd need to use a persistent variable.

If you intend using the MATLAB fft function then within a MATLAB Fcn block you'll need to define fft as being coder.extrinsic.

Phil.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
simulink Phil Goddard 15 Jul, 2012 10:04:12
fft Phil Goddard 15 Jul, 2012 10:04:12
rssFeed for this Thread

Contact us