Buffer All Sample Times Must Be Discrete No Continuous or Constant Sample Times Are Allowed
Welcome to EDAboard.com
Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
- Digital Design and Embedded Programming
- Digital Signal Processing
You should upgrade or use an alternative browser.
How to simulate in Simulink the FFT of "Sample-and-Hold"
- Thread starter pavel47
- Start date
- Status
- Not open for further replies.
- #1
- Joined
- Nov 8, 2005
- Messages
- 68
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- Switzerland
- Activity points
- 1,790
I've met difficulties while trying to simulate sinusoidal waveform passed through "Sample-and-Hold" module.
On the snapshot below my model. When I run simulation, the error occurs:
Error in 'Sample_and_Hold_test/Buffer': All sample times must be discrete. No continuous or constant sample times are allowed
"Sample-and-Hold" block outputs continuous signal, but "Buffer" requires discrete one.
How to proceed ?
Thanks in advance.
P.S. Model is in attachment.
Attachments
- #2
- #3
- Joined
- Nov 8, 2005
- Messages
- 68
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- Switzerland
- Activity points
- 1,790
Can you, please, attach some screenshot ... frankly speaking I didn't properly understood what you mean.
Thanks.
- #4
- #5
- Joined
- Nov 8, 2005
- Messages
- 68
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- Switzerland
- Activity points
- 1,790
There should be better alternatives to fix that issue, but the only one I see based on my previous experiments, could be by replacing all the stuffs before S/H blocks by an 1-D vector, in you case with the length of 4096 values. Don't know exactly what function could do that, but discretizer is the first one which come to mind.
Yes, it would be a solution ... i.e. transform the train of continuous values into 1-D vector in order to apply it to FFT, but unfortunately I didn't find any Simulink block capable to do it.
I turned my attention to "Zero-Order Hold" from Simulink "Discrete" library and also modified sinusoidal waveform output type from Discrete to Continuous.
This way "Zero-Order Hold" can be considered as "sampler".
Indeed it is the case - after "Zero-Order Hold" I can place "Buffer" and simulation runs, i.e.
Then I returned to my original task - simulate "Sample-and-Hold" behavior and its impact on incoming signal.
According to textbook (please see screenshot below), the "Sample-and-Hold" acts as filter having a characteristic
So if I apply, let say, 3 sinusoidal waveforms to such "Sample-and-Hold", it should filter out frequencies that close to Nyquist frequency.
But in my setup it doesn't ... all 3 sinusoidal waveforms manifest the same levels at the output of "Sample-and-Hold".
In correct simulation output of Sin_f3 < output of Sin_f2 < output of Sin_f1 .
So, the conclusion is: "Zero-Order Hold" cant transform continuous signal into discrete , but can't "emulate" real "Sample-and-Hold"
So, the problem apparently quite simple ... persists.
- #6
- #7
- Joined
- Nov 8, 2005
- Messages
- 68
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- Switzerland
- Activity points
- 1,790
Unfortunately doesn't work ... well it works, but as in previous case "Sample-and-Hold" block doesn't manifest any filtering action ... i.e. the power level upon FFT doesn't change when input frequency changes.
Here below the results of 2 simulations:
- f1 = 233Hz
- f1 = 27133Hz
Fig.1 Model
Fig.2 Simulation with f1 = 233Hz
Fig.3 Simulation with f1 = 27133Hz
- Status
- Not open for further replies.
Similar threads
- Digital Design and Embedded Programming
- Digital Signal Processing
- This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
kimbrellthelismor2002.blogspot.com
Source: https://www.edaboard.com/threads/how-to-simulate-in-simulink-the-fft-of-sample-and-hold.361167/
Post a Comment for "Buffer All Sample Times Must Be Discrete No Continuous or Constant Sample Times Are Allowed"