Transient problem

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

$i=e(\frac{-Rt}{L})[(\frac{-V}{\sqrt{R^2+(wL)^2)}}*sin(phi-atan(\frac{wL}{R})))+((\frac{V}{\sqrt{R^2+(wL)^2)}}*sin(wt+phi-atan(\frac{wL}{R})))$

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;

clc;

%%% value of parameters

V=325;

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

$phi=atan(wL/R)$;

$coswt=cos(pi/4);sinwt=sin(pi/4)$;

%%% equation of the current

$i=((cos(wt)-j*sin(wt))*((\frac{-V}{\sqrt{(R^2+(wL)^2))}}*sin(phi-atan(\frac{wL}{R})))+((\frac{V}{\sqrt{(R^2+(wL)^2))}}*sin(wt+phi-atan(\frac{wL}{R}))))$

plot(i)

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

• The core of the question is not EE. You need to learn how to use Matlab properly. – Dmitry Grigoryev Sep 7 '16 at 10:14
• @DmitryGrigoryev The core of this problem is the load is undefined. You cannot have a forcing function without a load. – 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.

%%

v=325;
w=2*pi*50;
wl=0.1;
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

i=exp(-r*t/l)*((-v/(sqrt(r^2+wl^2)))*sin(phi-atan(wl/r)))+((v/(sqrt(r^2+wl^2)))*sin(w*t+phi-atan(wl/r)));

plot(t,i)
xlabel 'time'
ylabel 'Current'


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

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.