0
$\begingroup$

Simulating of Sample-and-Hold fails: "Buffer" block generates the error "All sample times must be discrete. No continuous or constant sample times are allowed"

Any suggestions ? Thanks in advance.

Well, when I remove "Buffer" and set the parameter "Samples per Frame" in "Sine Wave", the FFT is calculated. But such setup isn't reliable ... I mean it doesn't represent the behavior of "Sample-and-Hold". The block "Sample-and-Hold", once applied to sampled signal works as sinc(x) function (sinc(x) = sin(x)/x). enter image description here

So, when the frequency of input signal approaches Nyquist frequency, after "Sample-and-Hold" it is filtered out. It is not the case in my setup: none of 3 frequencies is attenuated. enter image description here

$\endgroup$
2
  • $\begingroup$ The image urls are missing. $\endgroup$
    – Gilles
    Nov 13 '16 at 15:21
  • $\begingroup$ I've just edited the original post. The last picture shows unreliable simulation: if, as proposed Marcus (at least if I understood correctly his suggestion), I "emulate" "Sample-and-Hold" by specifying the sampling rate in 3 sinusoidal waveforms, and then do FFT on the sum of 3 waveforms, the result is erroneous: "Sample-and-Hold" acts as sinc(x) filter (please see the fragment from textbook) and should attenuate frequencies close to Nyquist frequency ... but it doesn't: FFT shows that all 3 constituents have the same level. $\endgroup$
    – Pavel_47
    Nov 13 '16 at 18:30
1
$\begingroup$

I'm no Simulink expert, but I'm pretty sure you don't want sample and hold, but just sample as functionality: As far as I can guess, sample and hold doesn't convert from simulatedly continuous signal to simulatedly discrete signal, but just actually does what its name says, and probably generates a continuous signal, not a discrete one.

In fact, seeing that you're already using a DSP sine, I'd say: instead of using a separate block with a trigger, just change that DSP Sine's sampling rate.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.