How to write the following equation using matlab

3 views (last 30 days)
Hi I would like to know how i should write the following equation in matlab. The equation will be used to sketch a graph but the correct graph is not being sketched and i feel like it has something to do with the way I wrote the equation. Could anyone please help me out
  3 Comments
Torsten
Torsten on 22 Sep 2022
Edited: Torsten on 22 Sep 2022
L = 1;
C = 1;
R = 1;
t = 0:0.0000001:0.003;
h = 2 * sin( sqrt(4*L-C*R^2)*t/(L*sqrt(2*C)) ) / (sqrt(C)*sqrt(4*L-C*R^2)) .* exp(-R*t/(2*L));
plot(t,h)

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 21 Sep 2022
syms U L C R t
h(t) = 2*sin(sqrt(U*L - C*R^2)/(L*sqrt(2*L))*t) / (sqrt(C)*sqrt(4*L-C*R^2)) * exp(-t*(R/2*L))
h(t) = 
Unfortunately you have to look very closely to see that the exponent is negative; I will remind Mathworks again that the negative exponent needs to be more clear.
You would need specific numeric values for C L R U in order to be able to plot this.
  7 Comments
Sam Chak
Sam Chak on 24 Sep 2022
Jadida, I'd suggest you show us the ordinary differential equation of RLC circuit.
We can probably use dsolve to verify if the analytical solution is the same as the equation provided by you.

Sign in to comment.

Categories

Find more on Language Fundamentals in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!