electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

sample-and-hold circuit simulation in MATLAB


Post new topic  Reply to topic    EDAboard.com Forum Index -> Analog Circuit Design -> sample-and-hold circuit simulation in MATLAB
Author Message
euniceliu



Joined: 26 Nov 2008
Posts: 8


Post04 Nov 2009 2:48   

sample-and-hold circuit simulation in MATLAB


Does anyone have ideas about how to simulate a sample-and-hold circuit using MATLAB code (not simulink)? The model I have is
Vo = Vi + (a0+a1*Vi+a2*Vi^2)*(dVo/dt).
I don't know how to derive the solution of Vo to model it? Thank you in advance.
Back to top
JoannesPaulus



Joined: 19 Mar 2008
Posts: 261
Helped: 44
Location: USA


Post04 Nov 2009 3:02   

sample-and-hold circuit simulation in MATLAB


you need not solving the "differential equation", since it is not one!
The model is simply telling you that the output of the SHA is non-linear and it is giving some coefficients. The term "dt" is your sampling period and "dVo" is the difference Vo(n)-Vo(n-1).
Back to top
euniceliu



Joined: 26 Nov 2008
Posts: 8


Post04 Nov 2009 3:37   

sample-and-hold circuit simulation in MATLAB


thank you very much! i will have a try.

Added after 33 minutes:

Hi, JoannesPaulus, I have another question. If "dVo" can be regarded as Vo(n)-Vo(n-1), then how can I get Vo(n) from a set of Vi(n) since I don't know the Vo(n-1) especial when n=1. Thanks!
Back to top
Google
AdSense
Google Adsense




Post04 Nov 2009 3:37   

Ads




Back to top
JoannesPaulus



Joined: 19 Mar 2008
Posts: 261
Helped: 44
Location: USA


Post04 Nov 2009 18:46   

sample-and-hold circuit simulation in MATLAB


If I understand correctly, what you are trying to do is a linear interpolation of your input, adding some distortion to model the effect of the non-linearity in the sample and hold circuit. So,
Vo(n)=Vo(n-1)+(Vi(n)-Vi(n-1))*dVo/dt is your linear interpolation, for n=2,... and Vo(1)=0;
The problem is how to model dVo, which is the local derivative of your signal. In the ideal SHA Vo(n)=Vi(n) and therefore dVo(n)=dVi(n) (but only at the sampling times). This is the easiest approximation.
Back to top
dick_freebird



Joined: 04 Mar 2008
Posts: 312
Helped: 45
Location: USA


Post06 Nov 2009 6:30   

sample-and-hold circuit simulation in MATLAB


I think you might be better off code-modeling the various
functions and artifacts of interest, in a more straightforward
and expressive way. Why would you want to do it using
polynomial math, when you can talk sample time and slope
error, sample pedestal, through-delay and rise-fall? I bet
there's an elegant one-liner that's like a koan or something,
if you only wanted the event value and not the details.

There's probably verilog-a code out there already that you
could dig up, rip up and turn into MATLAB or whatever.
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Analog Circuit Design -> sample-and-hold circuit simulation in MATLAB
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
sample-and-hold circuit simulation using MATLAB code (2)
S/H circuit - design sample and hold circuit for ADC help (2)
Sample and Hold Circuit (7)
sample and hold circuit (2)
Sample and Hold Circuit. (5)
sample and hold circuit (1)
Stability of sample and hold circuit (2)
sample and hold circuit design (6)
switched capacitor sample and hold circuit (5)
High Speed Sample and Hold Circuit !!! (5)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS