Thank you. That did get me to one continuous plot. I have some serious work to do with the domains but I think I can handle that. Thanks.
How to plot a capacitor charging and discharging
82 views (last 30 days)
I'm trying to plot the charging and then discharging of a capacitor in a simple RC circuit. I need it to be 3 complete cycles a 1kHz. The code I wrote just gives me 6 separate line segments. I can see why I'm not getting the plot that I want but I don't know how to get the plot that I want. Could anyone help me out with this please? Here is my code. I have all of the component values listed in the code. Like I said, it's pretty obvious why it's wrong. I just have no idea how to make it right.
tau = r*c;
More Answers (1)
Preethi on 30 Nov 2016
Since you are using separate variables which doesn't have any common values you might be getting separate lines. Try this at the end, you can remove 'hold on' also
vf = [v1,v2,v3,v4,v5,v6];