(*Inputs*)​​Vscc=1.5;=0.6;τ1=Vscc;τ2=fVscc;τ3m=fVscc;m=10;PAI=0.04819277;λ=0.03150354;PSA=0.025;ni=IntegerPart[(m-τ1-τ2)/τ3m]+2;​​vti=Flatten[Append[Append[{0,τ1,τ1+τ2},Table[τ1+τ2+(i-2)τ3m,{i,3,ni}]],m]];
In[]:=
(*FunctionusedrecursivelyinsidePiecewise*)​​FC1[t_]:=Count[vti,x_/;(t-Vscc)⩽x<t];​​FC2[t_]:=Count[vti,x_/;(t-fVscc)⩽x<t];
(*Whendefinepwtemp,PLOTreturns0-NOTOK!*)​​pwtemp=Piecewise[{{0,t<Vscc},{FC1[t],Vscc⩽t<2Vscc},{FC2[t],2Vscc⩽t<m}}];​​Plot[pwtemp,{t,0,m}]
Out[]=
(*WhenPLOTtheSAMEPiecewisedirectely,withoutdefiningpwtemp,returnsOK!*)​​Plot[Piecewise[{{0,t<Vscc},{FC1[t],Vscc⩽t<2Vscc},{FC2[t],2Vscc⩽t<m}}],{t,0,m},PlotRangeFull,FillingAxis,PlotTheme"Detailed"]
Out[]=
0
t<Vscc
FC1(t)
Vscc≤t<2Vscc
FC2(t)
2Vscc≤t<m
(*QUESTION:​​HowcanIevaluateFC1andFC2duringPiecewiseconstruction,andTHEN,savetheresultina"pwtemp"function,sothatFC1andFC2areNOTevaluatedAGAINeachtimeIcall"pwtemp"?*)