現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
Zero Crossing of Signal
7 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone.

I want to find the zero crossing of my Signals. I used below code but it works incorrectly.
%%%%%%%%%%%Time Domain DA3 %%%%%%%%%%%
da3=da2*tf3;
da3s=ilaplace(da3);
da3t=subs(da3s,{t},{time});
//da3t is signal of which i need zero corssings
zci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0);
zx = zci(da3t); //to find zero crossings
close all
figure;
plot(time(zx), da3t(zx), 'bp')
plot(time*1e9,da3t ,'-k','LineWidth',2);
xlabel('Time - [ns]');ylabel('Amplitude - [V]');
title('DA Transient Output ');
hold on
grid on
plot(time(zx), da3t(zx), 'bp') // to plot zero crossing
採用された回答
Star Strider
2020 年 4 月 11 日
The ‘zci’ funciton works correctly, although the latest version of it is:
zci = @(v) find(v(:).*circshift(v(:), 1, 1) <= 0); % Returns Approximate Zero-Crossing Indices Of Argument Vector (>= R2016b)
to work with more recent MATLAB releases. Note that it returns the indices of the approximate zero-crossings. If you want the exact zero-croissings, you need to interpolate to find them.
I cannot run your code, so I cannot correct the errors.
22 件のコメント
Star Strider
2020 年 4 月 11 日
編集済み: Star Strider
2020 年 4 月 11 日
I do not understand what you are doing with these.
I will delete my Answer in a few minutes.
Syed Adeel
2020 年 4 月 11 日
DA1_T takes input from CSpreamp and Cspreamp takes input from analogsetion. If you have matlab open, can you please just open it.
You can just open them and run from Model_Analogsection file
Star Strider
2020 年 4 月 11 日
When I run it, I get:
Check for missing argument or incorrect argument data type in call to function 'solve'.
Error in cspreamp_model_function (line 51)
tf=solve(eq1,eq2,eq3,'vout,vgs1,vs6');
Error in Model_AnalogSection_ASD_ (line 56)
[tfcsp,tfvin,x1t,y1t,y2t,ys2]=cspreamp_model_function(QIN,QTIME,CD);
I am running R2020a. I believe quoted string arguments in the Symbollic Math Toolbox have been deprecated for the last several releases.
I will help you with the zero-crossings problem (since I wrote the ‘zci’ function), however I cannot correct everything that may be wrong with your code.
It would very much help of we could simply narrow the zero-crossing problem down to just that portion of the code, with everything else provided. I will revisit this when you have provided ‘da3’ ‘time’ and everything else, and the required syms statement necessary to run it.
.
Syed Adeel
2020 年 4 月 11 日
編集済み: Syed Adeel
2020 年 4 月 11 日
you are almost there.. but running wrong file. Just open MODEL_ANALOGSECTION_ASD and run that...
You are probably running the DA1_T.
I have seen your alot of answers in this regard on mathwork and I am trying myself too but couldnt do it.
A kind request please
Star Strider
2020 年 4 月 11 日
I ran that function, as the error mesages demonstrate.
The errors thrown are:
Check for missing argument or incorrect argument data type in call to function 'solve'.
Error in cspreamp_model_function (line 51)
tf=solve(eq1,eq2,eq3,'vout,vgs1,vs6');
Error in Model_AnalogSection_ASD_ (line 56)
[tfcsp,tfvin,x1t,y1t,y2t,ys2]=cspreamp_model_function(QIN,QTIME,CD);
The code will not work in R2020a. I can go no further.
Please provide whatever ‘da3’ and ‘time’ are, and the syms statement to use them, as in your original post.
.
Star Strider
2020 年 4 月 11 日
My pleasure.
I can help with your problem if I have ‘da3’ and ‘time’. You should be able to provide ‘da3’ and ‘time’ by using disp(da3), and disp(time), just after you create them, then copying them and pasting them here. The problem is that I cannot run your code (it is incompatible with R2020a and I no longer have access to R2016a), so I cannot create them myself.
Syed Adeel
2020 年 4 月 11 日
編集済み: Syed Adeel
2020 年 4 月 11 日
ahh Thankyou man. You are helping a helpless soul
Below are 4 points if that can help us. I have added a file including values of da3 and time
1:this is how i generate time axis
T=30/wu;
N=100;
time=1:1:N;
time=T*time/N;
2: syms t;
3: According to my teacher all i need is is to eliminate commas from equations to run it on 2019 and 20.
For example, in cspreamp model:
eq1='vout/rl+Gm1*vgs1+(vout-vgs1)/rf+s*cf*(vout-vgs1)=0';
eq2='-iin+(vout-vgs1)/rf+(vs6-vgs1)/r1+s*cf*(vout-vgs1)-s*capd*vgs1=0';
eq3='vs6=vout';
tf=solve(eq1,eq2,eq3,'vout,vgs1,vs6');
should be replaced with:
eq1=vout/rl+Gm1*vgs1+(vout-vgs1)/rf+s*cf*(vout-vgs1);
eq2=-iin+(vout-vgs1)/rf+(vs6-vgs1)/r1+s*cf*(vout-vgs1)-s*capd*vgs1;
eq3=vs6-vout
4: Below is my output of da3t and time if that is helpful. these values are also pasted in attached file
: da3=(106289905305526056831249415419639792655412670003175287055805123569562772147400151624883722626449841025520148270232260936103940035444151515360645311584385418261902226705387364684375*exp(-33533299520262933860288/2570478523955605107421875))/12663115219741558870562425116468432145732081027304379562478971527401549753743705612852284494925532384253072879897556573897844356883399886998263008787090541079200916803701715238912 - (689608970073799193821765353599374235750192592643403788055578976988650534520163692375362766220094578812702410668801521841786068526189613415781468634866291586530322333467684625*exp(-12574987320098600197608/10021172917869232421875))/89942502082429531531947759188060427990573615741769725242671291445954092962926065201419188012161102728878993190378227126742809247062922608246784 + (3457925511789976069573915117423271177046142569914138221750100266171307030115201580906729113058026018853526173565447995424028386379285698853383552301926144004760094991891616078837471359276092890361553997026570672178197978117676343054830192360239839897473604088999785171807857604785399736228973933024081461121821973657085896095281422139206688027785858934413895759044804608*exp(-1242735190751782477085997082786623237/990352031428304219919299379200000000))/451001199290914913825731079127324853274847412237208384647460878112681695403022363575728951518926323153369767926841738796321429162171894162217873300117775549082067578492479309553479206595738859481408800138319154688035090005638842543878334369546731810351508316935521139810758984140233477764477543075385432005855694503625430882612693734295125 - (296506392718655421700851339970697612259142797286683641835281572368651303587045563526185389614478457802002290948216073646243965823872463261850918606067480104559486231178766003505859375*exp(-201199797121577603161728/17030742483821089501953125))/44316545114296728606604997889530257041089706688988512049563656898656318109290475088569692068377390274775784233774140502954431957539057971089478956820772659510681195272039420255010816 + (122172463912303468082244561135277401884340814846945235478385411710615129537638238555794528647281703597012050684046930956324182427958988877325236468898469925907683597917940288206145904663108718455895751953125*exp(-973392109001189049308741113101139797798866152183290633/4175577721958128263149320552340104454465799978271484375)*(cosh((4715620245036975074103*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875) - (1205800937080021448345875199712269075663770032773513854523077846496290088694056734205195667053578258285521440952928487693281573511687453781855444069773*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((4715620245036975074103*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875))/35131706295510125625379210109551322799571482278784889640928984842561675950617985333496400489075120796612615405784429097445856389065558904905730706714884038332391490788512135571881845))/677860368552825873493551450661604361637988921442256562689906328778551503669130200571068001144922171315381508444839372003808301094947300432941275073500311367648841887775703834786268215842020813465715427002810368 + (250378039917298975061839911516951476641278578086365189876369621186297840462583612441044453012723670725610688103060814834838432023169984707859796185628006644468303030442059901555429469982112529620343787613526729100866729736328125*exp(-973392109001189049308741113101139797798866152183290633/4175577721958128263149320552340104454465799978271484375)*(cosh((4715620245036975074103*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875) + (206404965814186607158689102844822533724891521441505538838152912930564051801831301906816361058433358874884235955543939583518439669460867992109587949388274336958448567166781891954233912104888054768619*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((4715620245036975074103*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875))/23918224874847790880745583613492444834141038446929249965993543829274560118399598399044492756373317705541664002482645778372085715504499914528319307614058747413401149701252212251750928665363123729629845297264193487738459551301003305))/95613465934789352022951414569809458044155836986790121134552115290471209158419946455565723792232919157092594595324368556200403327654789049711334120258773838963413456055655437212762201832553276499115416512943235500206592735771099136 + (856873584127530128894410137933383874711876294888187305079768849088348255160828274683868689615371823938672709461238744021245438558265687538957104277454417691432472993041443560635452348838013096829737067211591410386745835046909208448858745085852397235400077342988680922718340518018164723228623382900876978467207882565545738091627170867919921875*exp(-973392109001189049308741113101139797798866152183290633/4175577721958128263149320552340104454465799978271484375)*(cosh((4715620245036975074103*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875) - (344434948217199054077565933210170012529105221291843226353569638784700442331970724138253982103747677253458811493139641916604898625232695037837280826506118719190832330452028710596161234511027520872372437211802477449285926918140600765677746219289233635*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((4715620245036975074103*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875))/14340675137330700640073698100289498638318712189267091265698639417963954085207151236414288938946520483025480993650896621025731375709602047123311045570425785454205586429346461081861159334471192921965831159233939245426408145614010638453098622078679987568487391566692041860240776120199))/63717281011880677188540701240543100601872169102341892722108232486258743342961390482023476533437426295145771238145872361907637382908402278031164398698035316553276629554241854332978584675468614925807868073749040972420040665863493839822366040302362665653451392426746985018685794870224224177975151557325465289831253820987218263575565452848800989184 - (3147246997673512275721324462629014129926488618141331681607313138808401307593683142376526632418591812819244419117665464358481219369498554285814331466480203413583206069113717287470203037165553852519971843603515625*exp(-973392109001189049308741113101139797798866152183290633/4175577721958128263149320552340104454465799978271484375)*(cosh((4715620245036975074103*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875) + (892912614916371512522271499296538112465521508330316566636431755943197128867012734061932487507091237633064112002867063870409246293906209873415561808633780882315757245*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((4715620245036975074103*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875))/41653954668748031364845946550183016518412197682130800450179202248147473075544350326373734792068115542566017427277747589706948289418146102097654479159900201242899769730208372770303442411518769359247))/94125754033335249862247430006154205644589318805981911276369850224678865938056364993582585301837764359792975172626267083957381237755539431545559910206043235622096330702569161058893243685492032955525056435247382528 + (3751963009328562806003197580368635076374532309927144574514372677011605514718986657351742523232881245865391736856946712363211891347381947609072248772239442298772434012644594968143176222723969559540158695068307839184641649998851666323233585987465983036945173576266555413989735878129652550357093895831277626249243420223250047274301758899688720703125*exp(-973392109001189049308741113101139797798866152183290633/4175577721958128263149320552340104454465799978271484375)*(cosh((4715620245036975074103*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875) + (198301800621821432304856106326714301858384786573407883736859681466015358295932366665519465880678563950903998701916311338036085525995745663587660831403917820582191839834623768031117546540782454618492281206724128642503881459588015589731133480858354885772052956846076993856582053975*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((4715620245036975074103*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875))/20860186647094621474072967184991683738259560371020061494322692752970326452951658918794818022239412906468957603404390376091021763789144122861300494752716601779457164711991938110692747906296477421882308617532619691154763230209629734333590251996979189878115729226922653463166762813016428877935740811862593076316429))/30966598571774009113630780802903946892509874183738159862944600988321749264679235774263409595250589179440844821738893967887111768093483507123145897767245163844892441963361541205827592152277746853942623883842033912596139763609658006153669895586948255507577376719399034719081296306928972950495923656860176130857989356999788076097724810084517280743424 - (11187500120462121128734357198956088696713352967302401340255194806832393758928153704810320666383451920721966012532136243026551349739521214660355825352365711447218271984795469995573385976406780117219783512297748272199509074763417230805081973706605000567850271860018511453128877538072508301543293044418483843564453626766443312523545062482452392578125*exp(-973392109001189049308741113101139797798866152183290633/4175577721958128263149320552340104454465799978271484375)*(cosh((4715620245036975074103*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875) + (251880160556221219215724867845527897021102356365602770630435744249336226531412919434080537770624585377970102867239998695826582414964129626493085745182088261136119566971693182665590790461459689595436443394069378836501806492068770128032451728180886711571660744911261*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((4715620245036975074103*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875))/8617581464418069851496335351486567580693434576117403938828275459835853886958528997517245470164943669493186210916768234272620857984923678990593560552610913005691444952027306261812965610285636480402159041668416162548105608508558019826574857493011324235808933265117638661636765403807375874241000495))/8847599591935431175323080229401127683574249766782331389412743139520499789908353078360974170071596908411669949068255419396317648026709573463755970790641475384254983418103297487379312043507927672555035395383438260741754218174188001758191398739128073002164964776971152776880370373408277985855978187674336037387996959142796593170778517167004937355264 + 4168272783142694753560770681018671763925/245884044994739631562134407324002129281024, (106289905305526056831249415419639792655412670003175287055805123569562772147400151624883722626449841025520148270232260936103940035444151515360645311584385418261902226705387364684375*exp(-276757660847491926580864/7711435571866815322265625))/12663115219741558870562425116468432145732081027304379562478971527401549753743705612852284494925532384253072879897556573897844356883399886998263008787090541079200916803701715238912 - (689608970073799193821765353599374235750192592643403788055578976988650534520163692375362766220094578812702410668801521841786068526189613415781468634866291586530322333467684625*exp(-34594707605936490822608/10021172917869232421875))/89942502082429531531947759188060427990573615741769725242671291445954092962926065201419188012161102728878993190378227126742809247062922608246784 + (3457925511789976794309932266001451733820421014096435671920615318385919899451542301042339721484769900245872146172543624532282738305349357091266348885331284636895417341954800811850976116741970600595504714043096156234497080891455987814243127504181267277263115259318982721057230762032816409106395175122562886435521201476619732056172132879378582981356886663666247759044804608*exp(-1709427590712215733349230305675538181/495176015714152109959649689600000000))/451001199290914913825731079127324853274847412237208384647460878112681695403022363575728951518926323153369767926841738796321429162171894162217873300117775549082067578492479309553479206595738859481408800138319154688035090005638842543878334369546731810351508316935521139810758984140233477764477543075385432005855694503625430882612693734295125 - (296506392718655421700851339970697612259142797286683641835281572368651303587045563526185389614478457802002290948216073646243965823872463261850918606067480104559486231178766003505859375*exp(-553515321694983853161728/17030742483821089501953125))/44316545114296728606604997889530257041089706688988512049563656898656318109290475088569692068377390274775784233774140502954431957539057971089478956820772659510681195272039420255010816 + (122172463912303468082244561135277401884340814846945235478385411710615129537638238555794528647281703597012050684046930956324182427958988877325236468898469925907683597917940288206145904663108718455895751953125*exp(-2677872711887391211817247231091812136641212103599306258/4175577721958128263149320552340104454465799978271484375)*(cosh((12973015352226184058478*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875) - (1205800937080021448345875199712269075663770032773513854523077846496290088694056734205195667053578258285521440952928487693281573511687453781855444069773*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((12973015352226184058478*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875))/35131706295510125625379210109551322799571482278784889640928984842561675950617985333496400489075120796612615405784429097445856389065558904905730706714884038332391490788512135571881845))/677860368552825873493551450661604361637988921442256562689906328778551503669130200571068001144922171315381508444839372003808301094947300432941275073500311367648841887775703834786268215842020813465715427002810368 + (250378039917298975061839911516951476641278578086365189876369621186297840462583612441044453012723670725610688103060814834838432023169984707859796185628006644468303030442059901555429469982112529620343787613526729100866729736328125*exp(-2677872711887391211817247231091812136641212103599306258/4175577721958128263149320552340104454465799978271484375)*(cosh((12973015352226184058478*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875) + (206404965814186607158689102844822533724891521441505538838152912930564051801831301906816361058433358874884235955543939583518439669460867992109587949388274336958448567166781891954233912104888054768619*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((12973015352226184058478*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875))/23918224874847790880745583613492444834141038446929249965993543829274560118399598399044492756373317705541664002482645778372085715504499914528319307614058747413401149701252212251750928665363123729629845297264193487738459551301003305))/95613465934789352022951414569809458044155836986790121134552115290471209158419946455565723792232919157092594595324368556200403327654789049711334120258773838963413456055655437212762201832553276499115416512943235500206592735771099136 + (856873584127530128894410137933383874711876294888187305079768849088348255160828274683868689615371823938672709461238744021245438558265687538957104277454417691432472993041443560635452348838013096829737067211591410386745835046909208448858745085852397235400077342988680922718340518018164723228623382900876978467207882565545738091627170867919921875*exp(-2677872711887391211817247231091812136641212103599306258/4175577721958128263149320552340104454465799978271484375)*(cosh((12973015352226184058478*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875) - (344434948217199054077565933210170012529105221291843226353569638784700442331970724138253982103747677253458811493139641916604898625232695037837280826506118719190832330452028710596161234511027520872372437211802477449285926918140600765677746219289233635*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((12973015352226184058478*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875))/14340675137330700640073698100289498638318712189267091265698639417963954085207151236414288938946520483025480993650896621025731375709602047123311045570425785454205586429346461081861159334471192921965831159233939245426408145614010638453098622078679987568487391566692041860240776120199))/63717281011880677188540701240543100601872169102341892722108232486258743342961390482023476533437426295145771238145872361907637382908402278031164398698035316553276629554241854332978584675468614925807868073749040972420040665863493839822366040302362665653451392426746985018685794870224224177975151557325465289831253820987218263575565452848800989184 - (3147246997673512275721324462629014129926488618141331681607313138808401307593683142376526632418591812819244419117665464358481219369498554285814331466480203413583206069113717287470203037165553852519971843603515625*exp(-2677872711887391211817247231091812136641212103599306258/4175577721958128263149320552340104454465799978271484375)*(cosh((12973015352226184058478*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875) + (892912614916371512522271499296538112465521508330316566636431755943197128867012734061932487507091237633064112002867063870409246293906209873415561808633780882315757245*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((12973015352226184058478*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875))/41653954668748031364845946550183016518412197682130800450179202248147473075544350326373734792068115542566017427277747589706948289418146102097654479159900201242899769730208372770303442411518769359247))/94125754033335249862247430006154205644589318805981911276369850224678865938056364993582585301837764359792975172626267083957381237755539431545559910206043235622096330702569161058893243685492032955525056435247382528 + (3751963009328562806003197580368635076374532309927144574514372677011605514718986657351742523232881245865391736856946712363211891347381947609072248772239442298772434012644594968143176222723969559540158695068307839184641649998851666323233585987465983036945173576266555413989735878129652550357093895831277626249243420223250047274301758899688720703125*exp(-2677872711887391211817247231091812136641212103599306258/4175577721958128263149320552340104454465799978271484375)*(cosh((12973015352226184058478*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875) + (198301800621821432304856106326714301858384786573407883736859681466015358295932366665519465880678563950903998701916311338036085525995745663587660831403917820582191839834623768031117546540782454618492281206724128642503881459588015589731133480858354885772052956846076993856582053975*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((12973015352226184058478*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875))/20860186647094621474072967184991683738259560371020061494322692752970326452951658918794818022239412906468957603404390376091021763789144122861300494752716601779457164711991938110692747906296477421882308617532619691154763230209629734333590251996979189878115729226922653463166762813016428877935740811862593076316429))/30966598571774009113630780802903946892509874183738159862944600988321749264679235774263409595250589179440844821738893967887111768093483507123145897767245163844892441963361541205827592152277746853942623883842033912596139763609658006153669895586948255507577376719399034719081296306928972950495923656860176130857989356999788076097724810084517280743424 - (11187500120462121128734357198956088696713352967302401340255194806832393758928153704810320666383451920721966012532136243026551349739521214660355825352365711447218271984795469995573385976406780117219783512297748272199509074763417230805081973706605000567850271860018511453128877538072508301543293044418483843564453626766443312523545062482452392578125*exp(-2677872711887391211817247231091812136641212103599306258/4175577721958128263149320552340104454465799978271484375)*(cosh((12973015352226184058478*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875) + (251880160556221219215724867845527897021102356365602770630435744249336226531412919434080537770624585377970102867239998695826582414964129626493085745182088261136119566971693182665590790461459689595436443394069378836501806492068770128032451728180886711571660744911261*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((12973015352226184058478*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/20877888609790641315746602761700522272328999891357421875))/8617581464418069851496335351486567580693434576117403938828275459835853886958528997517245470164943669493186210916768234272620857984923678990593560552610913005691444952027306261812965610285636480402159041668416162548105608508558019826574857493011324235808933265117638661636765403807375874241000495))/8847599591935431175323080229401127683574249766782331389412743139520499789908353078360974170071596908411669949068255419396317648026709573463755970790641475384254983418103297487379312043507927672555035395383438260741754218174188001758191398739128073002164964776971152776880370373408277985855978187674336037387996959142796593170778517167004937355264 + 4168272783142694753560770681018671763925/245884044994739631562134407324002129281024, (3457925511789977519045949414579889423749002731372114853398558096719355570744688902777604009936662486097251916639685651678505312040438163040530335282779672944772774090916976736838238720102226333938427163231675906463460308176298389183740232370954774521589650628020478752093760283918389154155211781759550813751236293906719961468266235374863537196102745946775529551044804608*exp(-11189950344194162456777469372286137099/1980704062856608439838598758400000000))/451001199290914913825731079127324853274847412237208384647460878112681695403022363575728951518926323153369767926841738796321429162171894162217873300117775549082067578492479309553479206595738859481408800138319154688035090005638842543878334369546731810351508316935521139810758984140233477764477543075385432005855694503625430882612693734295125 - (689608970073799193821765353599374235750192592643403788055578976988650534520163692375362766220094578812702410668801521841786068526189613415781468634866291586530322333467684625*exp(-56614427891774389260108/10021172917869232421875))/89942502082429531531947759188060427990573615741769725242671291445954092962926065201419188012161102728878993190378227126742809247062922608246784 - (27663404094319810205010497198900064316696450180530468008831342238841635761196735779257553385893093932260209356204963455922888591048546082982332618631213096185105218290874705632570485430591478567900719004997582748921528591621254717470507659365872132472476719235644500878083843229988050821425109747338524088453620518868670354416595842220758956586449727671524586736844800*exp(-9530552178757709212871002274425/5070602400912917605986812821504))/3608009594327319310605848633018598826198779297897667077179687024901453563224178908605831612151410585226958143414733910370571433297375153297742986400942204392656540627939834476427833652765910875851270401106553237504280720045110740351026674956373854482812066535484169118486071873121867822115820344603083456046845556029003447060901549874361 + (296506392718655421700851339970697612259142797286683641835281572368651303587045563526185389614478457802002290948216073646243965823872463261850918606067480104559486231178766003505859375*exp(-30860076693614144/1743948030343279565))/44316545114296728606604997889530257041089706688988512049563656898656318109290475088569692068377390274775784233774140502954431957539057971089478956820772659510681195272039420255010816 - (106289905305526056831249415419639792655412670003175287055805123569562772147400151624883722626449841025520148270232260936103940035444151515360645311584385418261902226705387364684375*exp(-15430038346807072/789651002559161889))/12663115219741558870562425116468432145732081027304379562478971527401549753743705612852284494925532384253072879897556573897844356883399886998263008787090541079200916803701715238912 + (689608970073799193821765353599374235750192592643403788055578976988650534520163692375362766220094578812702410668801521841786068526189613415781468634866291586530322333467684625*exp(-9643773966754420/5130840533949047))/89942502082429531531947759188060427990573615741769725242671291445954092962926065201419188012161102728878993190378227126742809247062922608246784 + (106289905305526056831249415419639792655412670003175287055805123569562772147400151624883722626449841025520148270232260936103940035444151515360645311584385418261902226705387364684375*exp(-50323935903799457120096/856826174651868369140625))/12663115219741558870562425116468432145732081027304379562478971527401549753743705612852284494925532384253072879897556573897844356883399886998263008787090541079200916803701715238912 - (296506392718655421700851339970697612259142797286683641835281572368651303587045563526185389614478457802002290948216073646243965823872463261850918606067480104559486231178766003505859375*exp(-905830846268390228161728/17030742483821089501953125))/44316545114296728606604997889530257041089706688988512049563656898656318109290475088569692068377390274775784233774140502954431957539057971089478956820772659510681195272039420255010816 + (856873584127530128894410137933383874711876294888187305079768849088348255160828274683868689615371823938672709461238744021245438558265687538957104277454417691432472993041443560635452348838013096829737067211591410386745835046909208448858745085852397235400077342988680922718340518018164723228623382900876978467207882565545738091627170867919921875*exp(-8764706629547187958135963102716117957118693503649784391/8351155443916256526298641104680208908931599956542968750)*(cosh((42460820918830791945081*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/41755777219581282631493205523401044544657999782714843750) - (344434948217199054077565933210170012529105221291843226353569638784700442331970724138253982103747677253458811493139641916604898625232695037837280826506118719190832330452028710596161234511027520872372437211802477449285926918140600765677746219289233635*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((42460820918830791945081*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/41755777219581282631493205523401044544657999782714843750))/14340675137330700640073698100289498638318712189267091265698639417963954085207151236414288938946520483025480993650896621025731375709602047123311045570425785454205586429346461081861159334471192921965831159233939245426408145614010638453098622078679987568487391566692041860240776120199))/63717281011880677188540701240543100601872169102341892722108232486258743342961390482023476533437426295145771238145872361907637382908402278031164398698035316553276629554241854332978584675468614925807868073749040972420040665863493839822366040302362665653451392426746985018685794870224224177975151557325465289831253820987218263575565452848800989184 - (3147246997673512275721324462629014129926488618141331681607313138808401307593683142376526632418591812819244419117665464358481219369498554285814331466480203413583206069113717287470203037165553852519971843603515625*exp(-8764706629547187958135963102716117957118693503649784391/8351155443916256526298641104680208908931599956542968750)*(cosh((42460820918830791945081*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/41755777219581282631493205523401044544657999782714843750) + (892912614916371512522271499296538112465521508330316566636431755943197128867012734061932487507091237633064112002867063870409246293906209873415561808633780882315757245*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((42460820918830791945081*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/41755777219581282631493205523401044544657999782714843750))/41653954668748031364845946550183016518412197682130800450179202248147473075544350326373734792068115542566017427277747589706948289418146102097654479159900201242899769730208372770303442411518769359247))/94125754033335249862247430006154205644589318805981911276369850224678865938056364993582585301837764359792975172626267083957381237755539431545559910206043235622096330702569161058893243685492032955525056435247382528 - (856873584127530128894410137933383874711876294888187305079768849088348255160828274683868689615371823938672709461238744021245438558265687538957104277454417691432472993041443560635452348838013096829737067211591410386745835046909208448858745085852397235400077342988680922718340518018164723228623382900876978467207882565545738091627170867919921875*exp(-298598264675029288916521800544041965462936630293/855158317457024668292980849119253392274595835550)*(cosh((1446566095013163*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/4275791587285123341464904245596266961372979177750) - (344434948217199054077565933210170012529105221291843226353569638784700442331970724138253982103747677253458811493139641916604898625232695037837280826506118719190832330452028710596161234511027520872372437211802477449285926918140600765677746219289233635*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((1446566095013163*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/4275791587285123341464904245596266961372979177750))/14340675137330700640073698100289498638318712189267091265698639417963954085207151236414288938946520483025480993650896621025731375709602047123311045570425785454205586429346461081861159334471192921965831159233939245426408145614010638453098622078679987568487391566692041860240776120199))/63717281011880677188540701240543100601872169102341892722108232486258743342961390482023476533437426295145771238145872361907637382908402278031164398698035316553276629554241854332978584675468614925807868073749040972420040665863493839822366040302362665653451392426746985018685794870224224177975151557325465289831253820987218263575565452848800989184 + (3751963009328562806003197580368635076374532309927144574514372677011605514718986657351742523232881245865391736856946712363211891347381947609072248772239442298772434012644594968143176222723969559540158695068307839184641649998851666323233585987465983036945173576266555413989735878129652550357093895831277626249243420223250047274301758899688720703125*exp(-8764706629547187958135963102716117957118693503649784391/8351155443916256526298641104680208908931599956542968750)*(cosh((42460820918830791945081*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/41755777219581282631493205523401044544657999782714843750) + (198301800621821432304856106326714301858384786573407883736859681466015358295932366665519465880678563950903998701916311338036085525995745663587660831403917820582191839834623768031117546540782454618492281206724128642503881459588015589731133480858354885772052956846076993856582053975*76858149150051490980345126256216363917759933852084073919918845849^(1/2)*sinh((42460820918830791945081*76858149150051490980345126256216363917759933852084073919918845849^(1/2))/41755777219581282631493205523401044544657999782714843750))/2086018664709462147407... Output truncated. Text exceeds maximum line length of 25,000 characters for Command Window display.
2.33142857142857e-09 4.66285714285714e-09 6.99428571428572e-09 9.32571428571429e-09 1.16571428571429e-08 1.39885714285714e-08 1.63200000000000e-08 1.86514285714286e-08 2.09828571428571e-08 2.33142857142857e-08 2.56457142857143e-08 2.79771428571429e-08 3.03085714285714e-08 3.26400000000000e-08 3.49714285714286e-08 3.73028571428571e-08 3.96342857142857e-08 4.19657142857143e-08 4.42971428571429e-08 4.66285714285714e-08 4.89600000000000e-08 5.12914285714286e-08 5.36228571428572e-08 5.59542857142857e-08 5.82857142857143e-08 6.06171428571429e-08 6.29485714285714e-08 6.52800000000000e-08 6.76114285714286e-08 6.99428571428572e-08 7.22742857142857e-08 7.46057142857143e-08 7.69371428571429e-08 7.92685714285715e-08 8.16000000000000e-08 8.39314285714286e-08 8.62628571428572e-08 8.85942857142857e-08 9.09257142857143e-08 9.32571428571429e-08 9.55885714285715e-08 9.79200000000000e-08 1.00251428571429e-07 1.02582857142857e-07 1.04914285714286e-07 1.07245714285714e-07 1.09577142857143e-07 1.11908571428571e-07 1.14240000000000e-07 1.16571428571429e-07 1.18902857142857e-07 1.21234285714286e-07 1.23565714285714e-07 1.25897142857143e-07 1.28228571428571e-07 1.30560000000000e-07 1.32891428571429e-07 1.35222857142857e-07 1.37554285714286e-07 1.39885714285714e-07 1.42217142857143e-07 1.44548571428571e-07 1.46880000000000e-07 1.49211428571429e-07 1.51542857142857e-07 1.53874285714286e-07 1.56205714285714e-07 1.58537142857143e-07 1.60868571428571e-07 1.63200000000000e-07 1.65531428571429e-07 1.67862857142857e-07 1.70194285714286e-07 1.72525714285714e-07 1.74857142857143e-07 1.77188571428571e-07 1.79520000000000e-07 1.81851428571429e-07 1.84182857142857e-07 1.86514285714286e-07 1.88845714285714e-07 1.91177142857143e-07 1.93508571428571e-07 1.95840000000000e-07 1.98171428571429e-07 2.00502857142857e-07 2.02834285714286e-07 2.05165714285714e-07 2.07497142857143e-07 2.09828571428571e-07 2.12160000000000e-07 2.14491428571429e-07 2.16822857142857e-07 2.19154285714286e-07 2.21485714285714e-07 2.23817142857143e-07 2.26148571428571e-07 2.28480000000000e-07 2.30811428571429e-07 2.33142857142857e-07
0.2261 0.2285 0.2308 0.2331
Syed Adeel
2020 年 4 月 11 日
Rf=40e3; Cf=680e-15;
R2=16e3;
R1=16e3;
wu=1/((R1*Rf/(R1+Rf))*Cf)
syms t;
T=30/wu;
N=100;
time=1:1:N;
time=T*time/N;
Q=5e-15;
QTIME=4e-9; % Max 11ns
I=Q/QTIME;
to1=1e-9;
to2=to1+QTIME;
x1s=(exp(-s*to1))*1/s-(exp(-s*to2))*(1/s);
I=Q/QTIME;
ip=I*x1s;
%%%%%%%%%%%%%%%%%%%%%%%%%Time Domain DA1-DA3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
syms gda1 t1da1;
tf_da1=gda1/(1+s*t1da1);
tf=subs(tf_da1,{gda1,t1da1},{R2da1/R1da1,tau1da1});
pretty(tf);
%%%%% DA2 Transfer Function %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
syms r1da2 r2da2 c1da2;
tf_da2=(r2da2/r1da2)*(1+s*c1da2*2*r1da2)/(1+s*c1da2*r1da2);
tf_da2=tf_da2./(1+s/(2*pi*150e6));
tf2=subs(tf_da2,{r1da2,r2da2,c1da2},{R1da2,R2da2,C1da2});
pretty(tf2);
%%%%% DA3 Transfer Function %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
syms r1da3 r2da3 c1da3;
tf_da3=s*c1da3*r2da3/(1+s*c1da3*r1da3);
tf_da3=0.1+tf_da3./(1+s/(2*pi*150e6));
tf3=subs(tf_da3,{r1da3,r2da3,c1da3},{R1da3,R2da3,C1da3});
pretty(tf3);
%%%%%%%%%%%Time Domain DA1 %%%%%%%%%%%
da1=ip*tf;
da11=ilaplace(da1);
da1t=subs(da11,{t},{time});
%%%%%%%%%%%Time Domain DA2 %%%%%%%%%%%
da2=da1*tf2;
da2s=ilaplace(da2);
da2t=subs(da2s,{t},{time});
%%%%%%%%%%%Time Domain DA3 %%%%%%%%%%%
da3=da2*tf3;
da3s = ilaplace (da3);
da3t = subs (da3s, {t}, {time});
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all
figure;
plot(time*1e9,da3t ,'-k','LineWidth',2); % Zero crossing for DA3
xlabel('Time - [ns]');ylabel('Amplitude - [V]');
title('DA Transient Output ');
hold on
grid on
Star Strider
2020 年 4 月 12 日
We still have a problem.
The ‘da3’ output ends with: ‘... Output truncated. Text exceeds maximum line length of 25,000 characters for Command Window display.’
Try it again with:
disp(vpa(da3))
and copy that to a Comment here.
The ‘time’ vector is fine, so you only need to try it again with ‘da3’.
.
Star Strider
2020 年 4 月 12 日
Unrecognized function or variable 's'.
Error in
x1s=(exp(-s*to1))*1/s-(exp(-s*to2))*(1/s);
That loooks like it is about 15 lines from the start.
Syed Adeel
2020 年 4 月 12 日
編集済み: Syed Adeel
2020 年 4 月 12 日
You are right My mind got dumb on this problem since morning. my apology boss. I just reconfirmed and its working, i correctd and have attached the output Graph attached.

Rf = 40e3; Cf = 680e-15;
R2 = 16e3;
R1 = 16e3;
wu = 1 / ((R1 * Rf / (R1 + Rf)) * Cf);
R1da1=1.35e3/2; %CHANGE FROM PAPER e3/2
R2da1=6.26e3/2;
fda1lp=150e6;%changed from 6 to 5
tau1da1=1/(2*pi*fda1lp);
%%% DA2 Parameters %%% %%%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%%
R1da2=2.43e3/2;
R2da2=6.26e3/2;
C1da2=84e-12;
%%% DA3 Parameters %%% %%%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%% %%%
R1da3=2.45e3/2;
R2da3=9.77e3/2;
C1da3=92e-12;
T = 30 / wu;
N = 100;
time = 1: 1: N;
time=T*time/N;
Q = 5e-15;
QTIME = 4e-9; % Max 11ns
I= Q / QTIME;
to1=1e-9;
to2=to1+QTIME;
syms s;
X1s = (exp (-s * to1)) * 1 / s- (exp (-s * to2)) * (1 / s);
I = Q / QTIME;
ip = I * X1s;
%%%%%%%%%%%%%%%%%%%%%%%%% Time Domain DA1-DA3 %%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%
syms gda1 t1da1 ;
tf_da1 = gda1 / (1 + s * t1da1);
tf = subs (tf_da1, {gda1, t1da1}, {R2da1 / R1da1, tau1da1});
pretty (tf);
%%%%% DA2 Transfer Function %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%
syms r1da2 r2da2 c1da2;
tf_da2=(r2da2/r1da2)*(1+s*c1da2*2*r1da2)/(1+s*c1da2*r1da2);
tf_da2=tf_da2./(1+s/(2*pi*150e6));
tf2=subs(tf_da2,{r1da2,r2da2,c1da2},{R1da2,R2da2,C1da2});
pretty(tf2);
syms r1da3 r2da3 c1da3;
tf_da3=s*c1da3*r2da3/(1+s*c1da3*r1da3);
tf_da3=0.1+tf_da3./(1+s/(2*pi*150e6));
tf3=subs(tf_da3,{r1da3,r2da3,c1da3},{R1da3,R2da3,C1da3});
pretty(tf3);
%%%%%%%%%%% Time Domain DA1 %%%%%%%%%%%
syms t ;
da1 = ip * tf;
DA11 = ilaplace (da1);
da1t = subs (DA11, {t}, {time});
%%%%%%%%%%% Time Domain DA2 %%%%%%%%%%%
da2 = da1 * tf2;
da2s = ilaplace (da2);
da2t = subs (da2s, {t}, {time});
%%%%%%%%%%% Time Domain DA3 %%%%%%%%%%%
da3 = da2 * tf3;
da3s = ilaplace (da3);
da3t = subs (da3s, {t}, {time}); % zerocrossing for this signal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%
close all
figure;
plot (time * 1e9, da3t, '-k' , 'LineWidth' , 2);
xlabel ( 'Time - [ns]' ); ylabel ( 'Amplitude - [V]' );
title ( 'DA Transient Output' );
hold on
grid on
legend ( 'DA1' , 'DA2' , 'DA3' );
Star Strider
2020 年 4 月 12 日
The problem remains:
Unrecognized function or variable 's'.
Error in
X1s = (exp (-s * to1)) * 1 / s- (exp (-s * to2)) * (1 / s);
Syed Adeel
2020 年 4 月 12 日
編集済み: Syed Adeel
2020 年 4 月 12 日
Its strange may be cecause of different models.Its working all perfect on my side.
anyways I am pasting da3 data which you asked earlier. you have time axis already right?
[ 0.00052492902895834518442473071775418, 0.029707601693261764684865438123012, 0.13035159519267053478088851505357, 0.24002048613488675467005864923271, 0.28832037664013864636336015907804, 0.28010744873600159263268293649611, 0.24167414402381481684539895527846, 0.19282894835094996379131961172033, 0.14445259703982544599191556034087, 0.10148681259108762074291644332478, 0.06557667204980987550529802498128, 0.03671284690180695510323536858459, 0.014151860784342023569727540756914, -0.0030971623846901892450120668400894, -0.016031037035416823010544849972469, -0.025545097453682728519499836610548, -0.032396297173260391680480864031008, -0.037201336857913150247984325265111, -0.040450471821815229699940852837794, -0.042526809805621522298633644608916, -0.043726022195311260496157740715343, -0.044274181491197231168480543130051, -0.044342909530830175632447876683159, -0.044061756566939165690663487199463, -0.04352806478475898936144747573041, -0.042814690792706284162673861869497, -0.041975976007834339736312728774132, -0.041052319641560078590882576729299, -0.040073656861324153531542389067994, -0.039062090094352847140654296222965, -0.038033871431447883771330271390009, -0.03700089133158659767904415941194, -0.035971793736858363454020155615465, -0.034952809665470354636309909704616, -0.033948379350299452874396758503254, -0.03296161595592350041230215174671, -0.031994650844637862777304572575085, -0.031048890418060953117201374319177, -0.030125207032903225019305747074325, -0.029224080814690027533017306725901, -0.028345704929651410394213647308712, -0.027490063680005835828683987702569, -0.026656990398541612101539145570876, -0.025846210334469084048822679350684, -0.025057372392294026348500600592329, -0.024290072594568303941772056083609, -0.023543871401846322291901451711195, -0.022818306474587271816039644976039, -0.022112902053902042203490860674789, -0.021427175834965847687541689498909, -0.020760643981766535032289855290677, -0.020112824764643109188924503139317, -0.019483241177907363795567416652393, -0.018871422802664970117350814135642, -0.018276907111530595223095322290723, -0.017699240361148502714516819077984, -0.017137978180742592985358774831358, -0.016592685936952725933482838637529, -0.016062938934461939989387737154504, -0.015548322496521555921418895302825, -0.015048431958057184252030837270063, -0.01456287259556333000325379091601, -0.014091259511706679880018943222857, -0.013633217487894516611286948190629, -0.013188380814604934966898738128525, -0.012756393106710164733524132873166, -0.01233690710912130366070648886937, -0.011929584496672390247773103879605, -0.011534095671115545616661697167191, -0.011150119557324351826144911479972, -0.010777343400227982210166260432171, -0.010415462563573762764862356315984, -0.010064180331300971028725411661537, -0.0097232077120759900701867801813873, -0.0093922632473672005465328448865389, -0.0090710728233108825468787199787957, -0.0087593694865263771516263348573503, -0.0084568932639698943208427452017985, -0.0081633909868662309628449031259329, -0.007878616118721156857530207651716, -0.0076023285873905215990694224566519, -0.0073342946211633247954676850758244, -0.0070742865888021983051229190020912, -0.0068220828434756031101911031631563, -0.0065774675705093990644158108968698, -0.0063402306388813196275319403968733, -0.0061101674563794155931078155514166, -0.0058870788283439649506269309580092, -0.0056707708199121095192656790271042, -0.0054610546216844426899170149417627, -0.0052577464187334531988320769354215, -0.0050606672628747411029409037364957, -0.0048696429481229700135722267181662, -0.004684503889256024770776771300699, -0.0045050850034121062746820052612318, -0.0043312255946462170630036227105962, -0.0041627692413738985913171902182268, -0.0039995636866317144571893307864772, -0.0038414607310856118288802072863864, -0.0036883161287197704465273556573539]
Star Strider
2020 年 4 月 12 日
The end of your code now becomes:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%
close all
figure;
zci = @(v) find(v(:).*circshift(v(:), [1 0]) <= 0); % Returns Approximate Zero-Crossing Indices Of Argument Vector
da3td = double(da3t);
idx = zci(da3td);
if da3td(1) * da3td(end) < 0
idx = idx(2:end);
end
for k = 1:numel(idx)
t_exact(k) = interp1(da3td(idx(k))+[-1 +1]*1E-5, time(idx(k))*1E9+[-1 +1], 0);
end
plot (time * 1e9, da3t, '-k' , 'LineWidth' , 2);
hold on
plot(time(idx)*1E9, da3td(idx), 'r+')
hold off
xlabel ( 'Time - [ns]' ); ylabel ( 'Amplitude - [V]' );
title ( 'DA Transient Output' );
hold on
grid on
legend ( 'DA1' , 'DA2' , 'DA3' );
text(t_exact, 0, sprintf('\\downarrow time = %.4f',t_exact), 'HorizontalAlignment','left', 'VerticalAlignment','bottom')
You can eliminate plotting the red ‘+’ if you want.
.
Syed Adeel
2020 年 4 月 12 日
Whoever you are , I repeat whoever.... I love you. Thankyou so much for your immediate replies,help,support to my problems. I have great respect for you.
Just one last thing if possible. How can i get those index values where signal zero crossing occurs? Lets suppose I run this signl for long and it crosses zero at multiplepoints , how can i get those time values?
Thanks you so much.
Star Strider
2020 年 4 月 12 日
Thank you!
As always, my pleasure!
The code I posted will detect all the zero-crossings of a specific function and will interpolate all of them to find the exact values of the ‘time’ value of the zero-crossings. (That is the reason I included the for loop, even though it is not needed here.) The code may need to be modified to show the zero-crossings on the plot, however the essence of the code I posted should work for all of them.
If you have several different curves, plotted on the same or different axes, it would be necessary to run my code to find all the zero-crossings for each one.
.
Syed Adeel
2020 年 4 月 15 日
@STARSTRIDER
Though my code wroks and everything is perfect but i need values of those ZERO CROSSINGS. If there are 3 zero crossings how can i save these into a vector or any variable?
Star Strider
2020 年 4 月 15 日
The indices returned by ‘zci’ will remain as a vector. The more precise values will be in the ‘t_exact’ vector in the comment I previously posted.
Syed Adeel
2020 年 4 月 15 日
Yea, you mentioned and I really appreciate that but when i try to read its value it gives NaN though it shows correct on Figure.
May be I am reading it wrong way
Star Strider
2020 年 4 月 16 日
It shows NaN because it is trying to extrapolate, although I am not certain what the reason is for that.
One solution for that is to let it extrapolate, and see what it returns:
t_exact(k) = interp1(da3td(idx(k))+[-1 +1]*1E-5, time(idx(k))*1E9+[-1 +1], 0, 'linear','extrap');
That should solve the extrapolation problem.
Another option (if the data permit it, so that it does not reference indices beyond the vector limits) is:
t_exact(k) = interp1(da3td(idx(k)+[-1 +1])*1E-5, time(idx(k)+[-1 +1])*1E9, 0);
If that needs to extrapolate, add those arguments.
その他の回答 (1 件)
Image Analyst
2020 年 4 月 11 日
Did you try to use find() to find out the first index where da3t goes negative?
firstNegIndex = find(da3t <= 0, 1, 'first')
firstNegTime = time(firstNegIndex)
By the way, time is a built-in function so you should not use that as the name of your variable.
3 件のコメント
Syed Adeel
2020 年 4 月 11 日
If I have to find 3 consecutive points where it crosses zero or x-axis do I have to repeat it 2 times more?
Image Analyst
2020 年 4 月 12 日
It only crosses once. Once it's crossed, the values are now below the x axis. So you'll only have one crossing per signal, or possibly more if it later goes from below to above the axis. But you won't have 3 consecutive points where there is a crossing unless the signal has a value of 0 for 3 elements consecutively, which your signals don't do.
Syed Adeel
2020 年 4 月 15 日
Thankyou so much for your reply. Your option gives me accrate first zero crossing. Now as I have 3 zero corssings can you please tell me how to extend your method?Thankyou
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
