我想用mathematics做出这样的函数图形

1个回答

  • 希望下面是你要的结果.f = 2*^3; e = 3; t0 = 22*^-6; Uc[t_] := If[Mod[2 (t*f),2] < 1,e*(1 - Exp[-Mod[2 (t*f),2]/f/t0]),e*(Exp[-(Mod[2 (t*f),2] - 1)/f/t0])]; Ua[t_] := If[Mod[2 (t*f),2] < 1,e,-e]; tu[1] = Plot[{Ua[t]},{t,-5 t0,5 t0},PlotStyle -> Blue] tu[2] = Plot[{Uc[t]},{t,-5 t0,5 t0},PlotStyle -> Green] Show[tu[1],tu[2]] 上面是你要的结果:不过如果是充放电的过程的话,你的t0好像太大了,以至于{t,-5 t0,5 t0},实际上还不到一个周期,如果你将程序改成下面的样子就可以看到整个周期的图象了,f = 2*^3; e = 3; t0 = 22*^-6; Uc[t_] := If[Mod[2 (t*f),2] < 1,e*(1 - Exp[-Mod[2 (t*f),2]/f/t0]),e*(Exp[-(Mod[2 (t*f),2] - 1)/f/t0])]; Ua[t_] := If[Mod[2 (t*f),2] < 1,e,-e]; tu[1] = Plot[{Ua[t]},{t,0,1/f},PlotStyle -> Blue] tu[2] = Plot[{Uc[t]},{t,0,1/f},PlotStyle -> Green] Show[tu[1],tu[2]]