0

The task is about resonant circuits. $I(t)$ is the searched function and describes the chronological sequence of the amperage. In case of $ D:= \frac{1}{LC} -\frac{R^2}{4L^2} > 0$ you can describe $I(t) = Re \left( \frac{U_0}{L(-w^2 + \frac{R}{L} i w+ \frac{1}{LC})} \exp (iwt) \right) + \exp(- \frac{R}{2L}t)(\alpha \cos(\sqrt{D} t) +\beta sin(\sqrt{D}t))$.

I got the values for $ C,L,t, R,U_0, \alpha, \beta$ and a vector of values for $w$.

vt needs to be a vector of 200 equidistant values of the times $t$. $w$ is a vector with 50 values. My code:

>> D=(1/L*C)-((R^.2)/(4*L^.2));
>> sD= sqrt(D);
>> vt=linspace(tmin,tmax,200);
>> vw=omega;
>> [vw,vt]=meshgrid(vw,vt);
>> I= real((U0.*exp(i.*vw.*vt))./(L*(-vw.^2+ (R/L).*i.*vw + (1/L.*C))))+exp((-R.*vt)/(2.*L).*(alpha.*cos( sD.*vt)+ beta.*sin( sD.*vt)));
>> surf(vw,vt,I)
>> 

amperage

Now, i am not sure if is really visualizing the sequence of the amperage right? It just doesnt look right to me, especially if i try other given values for $ C,L,t, R,U_0, \alpha, \beta, w $ I get a surf like :

enter image description here

1 Answers1

1

In the equation just before the error, I think you want to type real rather than Re. Matlab thinks you have a variable called Re and that you want the umpty-umpth index, which is a complex number. Similarly, with $I(vt)$. As said by @FabioSomenzi, just use $I$. Another thing that you doing wrong is using trying to solve this for both frequency and time at the same time. I think something is wrong with your equation, You say that $I$ is a function of $t$, but the equation says it's a function of $\omega$ and $t$.

Cye Waldman
  • 7,524
  • Thank you for your reply. I did the changes and tried first for only one value of w. But the error still occurs :( – wondering1123 Jul 11 '17 at 15:16
  • I'm looking at this part of your code: L(-vw.^2+ (R/L).i.vw + (1/L.*C))). I see that it's incorrect; L is a constant, but it's typed as though it's an indexed function. Try to figure out what is wrong. If the problem persists, post the revised code here so that I can look at it. Sorry for the delay, must be a time zone problem. – Cye Waldman Jul 11 '17 at 16:03
  • yeah i found the mistake..an '*' was missing there. It works if i take $w$ as a scalar. Now my problem is i wanna put the hole vector in the function. My idea is that $I$ is a two dimensional array..i hope i can work it out ^^ Thank you for your help. – wondering1123 Jul 13 '17 at 15:07
  • What you need to do in that case is to create a matrix with the $w$ and $t$ variables; you need the meshgrid function, as in [W,T]=meshgrid(w,t); then in your equations, make sure to use the '.*' for multiplications (and so on) and you'll end up with a matrix $I(w,t)$. You can then plot this is 3D with (I think) surf(w,t,I) or mesh(w,t,I). Good luck. – Cye Waldman Jul 13 '17 at 19:15
  • okay, i changed my question above totally, after trying to do what you told me, you can have a look at the plots :) – wondering1123 Jul 17 '17 at 09:07