How to write the following equation using matlab
Mostrar comentarios más antiguos
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
Respuestas (1)
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))
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 comentarios
Walter Roberson
el 22 de Sept. de 2022
What aspect of this answer did not work for you? I compared the result above to your formula image, and they match exactly -- unless, that is, you have particular reason to want sqrt(L)*L to be expressed in that form instead of the mathematically equivalent L^(3/2)
If you need to plot it at particular given times, then I suggest subs() of the constants into the formula, and then matlabFunction() to generate an anonymous function that you can use to evaluate the formula at particular time.
If you do not need to plot it at particular given times, just a time array, then I suggest subs() of the constants into the formula, and then fplot()
Jadida
el 23 de Sept. de 2022
As you can easily see from your choice of parameters for R,L and C, the expression 4*L - C*R^2 becomes negative.
R = 10000;
L = 0.01;
C = 0.000000033;
4*L - C*R^2
This means that sqrt(4*L - C*R^2) becomes a complex number.
Further according to your graphics,
exp(-t.*(R/2*L))
should be
exp(-R*t/(2*L))
This part is definitely not the same

Yours is
, because R is divided by 2 first, and then is multiplied with L.
Your graph blows up is because the value of the capacitance C is super small. Division by a very small value leads to ...
Jadida
el 24 de Sept. de 2022
Sam Chak
el 24 de Sept. de 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.
Categorías
Más información sobre Numeric Solvers en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

