I have RL circuit in series with AC source.

my question 1 is

  1. Find an expression (analytic) for i(t). Try remembering basic circuits: transient response of LR circuit to a sinusoidal forcing function with initial conditions.

I have answered it like below


now my 2nd question is

2.Use the above expression, e.g. in Matlab/Octave, to plot the resulting i(t) if:

\$V = 325 V, w = 2 ·ph. 50 Hz, wL = 0.1\$,

\$R = {0.01, 0.3}\$ (two different values to try)

\$wt0 = {0, pi/4 , Pi/2 }\$ rad (three values).

The above provides 6 combinations. Study the equation and compare plots with different parameter choices, to get a good feel for what situations of the fault-inception angle (wt0) and L/R ratio give the smallest and largest deviations from a pure sinusoid. “Sinusoid” in this case means the shape: I consider e.g. sin(wt) and sin(wt + pi/4 ) and cos(wt) all to be sinusoids, but sin(wt) + exp(−t/tau) is not purely sinusoidal. For submitting, plot just the two most extreme cases (i.e. the most and least similar to a pure sinusoid) over five cycles.

I have coded MATLAB like following but get no sinusoidal wave. I have got value of zero

close all;


%%% value of parameters


wL=0.1; R=0.01; wt=0;



%%% equation of the current



Would anyone help me to find the problem in MATLAB why I did not get any waveform?

  • 2
    \$\begingroup\$ The core of the question is not EE. You need to learn how to use Matlab properly. \$\endgroup\$ – Dmitry Grigoryev Sep 7 '16 at 10:14
  • \$\begingroup\$ @DmitryGrigoryev The core of this problem is the load is undefined. You cannot have a forcing function without a load. \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 May 19 '17 at 13:36

First, I don't see your time vector. Should be something like:

\$ t=linspace(0,5T);\$ where \$T\$ is your period.

Or you could do it this way: \$t=0:\frac{T}{10}:5T;\$

The \$\frac{T}{10}\$ term is the step size, you want to make it a lot smaller than the period of your wave so that your output has better resolution. Also, notice the use of a semicolon at the end of each line, so that you don't fill your command screen with all the numbers in the time vector.

Also, I see you are trying to plot something different from what you obtained in 1), you're using one that has a 'j' in it. Take your equation in 1) and plot that. The first term should vanish to zero because of the exponential term, the second term should stay.

It's not clear to me if your equation is right, but it looks to me you have something mixed up. You define \$\phi=\arctan{\frac{\omega L}{R}}\$ but inside of your sine functions you have exactly the negative version of that, so your canceling it out. I think you are confusing \$\phi\$ and it should probably be the \$\omega_{t0}\$ parameter you are given, that is, \$\phi=\omega_{t0}\$. That is just my guess since your question is not phrased very clear.

Using the parameters you have, I was able to make a quick plot.


phi=0;        % should also try pi/2, pi/4 as given
l=0.1/w;      % Inductance
T=1/50;       % Period
r=0.01;       % Try the other values too
t=0:T/10:5*T; % Time vector


xlabel 'time'
ylabel 'Current'

Again, if the equation is wrong, this is not meaningful to your problem. Here is one plot:

enter image description here

For the previous plot, I adjusted the step size to 1/20th of the period to have a better looking wave (smoother than 1/10th). I am also looking at 10 periods instead of 5. Those changes are not reflected in the code provided here.

I hope this gives you a better idea of how you should approach a problem like this.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.