Hi, kind of a Matlab newbie here, so maybe this will be a no-brainer for Matlab pros, but I can use some help. Am trying to simulate a simple RLC circuit to obtain the steady state response. I can get a correct answer with Mathcad, but not with Matlab. Here's the process:
EDU>> circuit1 = '2*pi*2000/( (2*pi*2000)^2 + s^2) = (470 + .033*s + (10^7)/s) * I'; % 'I' is the current, so I am using V = I * Z
The term on the left is the Laplace transform of a sinusoidal source, and the terms on the right are for the RLC circuit. (Multiplying, on the left, by a 1/s term for a step function does not change the outcome shown below.)
EDU>> Ifr = solve(circuit1,'I') % Ifr stands for I_frequency_domain Ifr = .126e8*s/(.742e14*s+.470e6*s^3+.152e11*s^2+33.*s^4+.158e19)
EDU>> Itd = ilaplace(Ifr); % Itd stands for I_time_domain
EDU>> simple(Itd) ans =
-.104e-2*exp(-.713e4*t)*cos(.159e5*t)
-.149e-2*exp(-.713e4*t)*sin(.159e5*t)
+.104e-2*exp(11.5*t)*cos(.126e5*t) +.129e-2*exp(11.5*t)*sin(.126e5*t)If we ignore the two exponentially decaying terms, the remaining two terms grow exponentially, which is simply not the correct steady-state solution. The frequencies give for the second two terms are correct (they equal 2 * 2000 pi, which is the source frequency, but the exponentially growing terms are a problem.
One possibility I can imagine: The Matlab documentation makes clear that "pi" is treated as a number, not a symbolic value, so that for example 'sin(pi)' does not come out to exactly zero. Perhaps this throws off the calculations somehow!? Any help or suggestions would be appreciated.
Steve O.
"Spying On The College Of Your Choice" -- How to pick the college that is the Best Match for a high school student's needs.